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
11
S
1
G
1
Posts: 42
Reputation: 1,461

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
8
Posts: 437
Reputation: 6,468

Post » Fri Aug 24, 2012 1:14 pm

How do I do that exactly?
B
11
S
1
G
1
Posts: 42
Reputation: 1,461

Post » Fri Aug 24, 2012 1:17 pm

nvm I've figured it out, thanks anyway
B
11
S
1
G
1
Posts: 42
Reputation: 1,461

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
158
S
66
G
43
Posts: 2,603
Reputation: 35,868


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests