Health bar resets its value when going to the next layout

Get help using Construct 2

Post » Sat Mar 11, 2017 5:59 pm

Hello all!

I have a health bar in a HUD global layer. When the player looses some life and then moves on to the next layout, the health bar resets to full.
How do i fix that?

Thank you in advance!
B
15
S
5
Posts: 10
Reputation: 1,086

Post » Sat Mar 11, 2017 6:01 pm

check the global variables operations on the layout transition
B
13
S
7
G
4
Posts: 429
Reputation: 4,184

Post » Sat Mar 11, 2017 6:39 pm

Hello and thanks for your reply. :)

Health variable is a local one, in the player, so no global i 'm afraid.
If i can do what you say with local, then could you please expand a bit?
B
15
S
5
Posts: 10
Reputation: 1,086

Post » Sat Mar 11, 2017 7:23 pm

iordanis21 wrote:Hello and thanks for your reply. :)

Health variable is a local one, in the player, so no global i 'm afraid.
If i can do what you say with local, then could you please expand a bit?


try this
"By default, local variables reset to their initial value whenever entering their scope (usually every tick), like local variables in programming languages. If the variable is marked static in the Event Variable dialog it will persist its value permanently, like a global variable."
B
13
S
7
G
4
Posts: 429
Reputation: 4,184

Post » Sat Mar 11, 2017 7:47 pm

Thank you very much for your reply NN81.

Have a good day :)
B
15
S
5
Posts: 10
Reputation: 1,086


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests