Game Development Reference
In-Depth Information
Add a custom event and call it
addScore
if you haven't yet. Using the
Integer+Integer
node and applying the
playerScore
variable as one of its inputs and the value of
1
to the
other input, you always get the value of 1 added to the latest score. By connecting the out-
put of this calculation to a
Set
node of the
playerScore
variable and applying the result as
a string to the
TextRenderer
node
SetText
, the score will be added and shown at the
same time in the game UI.
With the logic of showing a lose screen added to the bomb logic, we only have one case to
break the game loop, which is the losing case. Now, it is time to add the logic for a win
case.
By comparing the
playerScore
variable to
50
(the maximum for this level is 50 points) in-
side
Event Tick
, we can do whatever we want when the player hits 50. So using the
Open
Level
node and setting its
Level Name
to the
win
level, we will be loading the win level
once the player scores 50.
Search WWH ::
Custom Search