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
9
G
1
Posts: 41
Reputation: 1,259

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
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Fri Aug 24, 2012 1:14 pm

How do I do that exactly?
B
9
G
1
Posts: 41
Reputation: 1,259

Post » Fri Aug 24, 2012 1:17 pm

nvm I've figured it out, thanks anyway
B
9
G
1
Posts: 41
Reputation: 1,259

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
140
S
58
G
36
Posts: 2,547
Reputation: 31,170


Return to How do I....?

Who is online

Users browsing this forum: Muini and 29 guests