Local variable changes on reset

Get help using Construct 2

Post » Mon Dec 12, 2016 2:24 pm

Hi,

I have 2 non playable bad sprites each with local variable (health points) = 2

I have 1 playable sprite also with variable 'playerhealth)' = 2

I subtract 1 each time a bullet hits them.

When I reset (go to level 1) the game to allow the player to have bullets back the bad sprites have the correct health, eg: if they were shot before it restarted the level then they only have 1 health, this is perfect and what I want.

But even if player gets hits and it deducts 1 from his health, when the game resets (go to level 1) he has 2 again!

Everything seems identical to the bad sprites so I can't work out why the player returns with full health and they others are minus any hits.

Bad sprites
Image

Playable player
Image


Could it be where they are positioned in the events, or sub events?
Any ideas?
Thanks
B
10
S
3
Posts: 55
Reputation: 802

Post » Mon Dec 12, 2016 3:10 pm

Use persistent behavior on these enemies.
Image
B
108
S
24
G
18
Posts: 1,372
Reputation: 22,817

Post » Mon Dec 12, 2016 7:59 pm

THANK YOU SO MUCH!!!! You're a life saver!!!!

I had persist on the bad guys but didn't on the player, I've just added it and it works perfect.

Never thought to check that! well done, thank you :)

I'm happy now, thanks
B
10
S
3
Posts: 55
Reputation: 802


Return to How do I....?

Who is online

Users browsing this forum: komalrajsingh and 32 guests