Variable Value in Text

Get help using Construct 2

Post » Fri Aug 24, 2012 1:09 pm

I am working on the reload and ammo feature of my game and I want to display how much ammo is left in text/number

I created "ammo" variable in the main player and I want to know how do I put that value of ammo in a text on the HUD layer?


Thanks in advance
B
10
S
1
G
1
Posts: 41
Reputation: 1,434

Post » Fri Aug 24, 2012 1:10 pm

hmm, set a text object and fill it (using an event) with the value of the variable.
B
44
S
10
G
7
Posts: 437
Reputation: 5,963

Post » Fri Aug 24, 2012 1:14 pm

How do I do that exactly?
B
10
S
1
G
1
Posts: 41
Reputation: 1,434

Post » Fri Aug 24, 2012 1:17 pm

nvm I've figured it out, thanks anyway
B
10
S
1
G
1
Posts: 41
Reputation: 1,434

Post » Fri Aug 24, 2012 1:19 pm

Text: Set text to "variable-name"

remeber if for example your sprite is named "Gun" and instance variable is called "ammo"

it will look like this Gun.ammo

Text: Set text to Gun.ammo

You can put in the action when you press button/mouse to fire - so it will only update text object with new value every time you fire.
ImageImageImageImage
B
155
S
62
G
41
Posts: 2,587
Reputation: 34,414


Return to How do I....?

Who is online

Users browsing this forum: chrisinfinger, dzert14, imhotep22, JaisonAntoniazzi, mostsimplegames and 9 guests