Game Development Reference
In-Depth Information
uiText
To change the score value, I've added a custom event and called it
setScore
. This custom
event will be working on setting the value of the
Score
variable by adding
1
to it using the
integer + integer
node. The final result of the score value will be displayed in the UI using
the
Set text
node. Keep in mind that you can use whatever values you want, as long as you
are using the
add
node. This node will be working on adding the first passed integer value
to the second passed integer.
I wanted to follow a new method to change the value of ammo, which is closer to the code
environment that I have used over the years. It is called passing parameters. Basically,
when I called an event or function, I wanted to send the exact new value directly to it, and
then use it to set the ammo text based on the passed parameter. To add this type of paramet-
er passing, I've added a new custom event, called it
setAmmo
, and after selecting the node
in the side panel, I've added a new input to
Inputs
, set its type to
Integer
, and set its name
to
ammoAmount
. Now any call to this event will require passing an integer value, other-
wise it will use the default which, is set to
0
for now.
Finally, I used the passed ammo value from the
AmmoAmount
parameter and set it as a
string to the
Set text
node, to change the proper UI text.
Search WWH ::
Custom Search