How can I improve this health bar system?

Get help using Construct 2

Post » Tue Mar 01, 2016 4:26 am

How can I improve this health bar system?
It turns out that even where I work to reduce the green bar represents good health and appearance of the red bar representing loss of health, but Quanda health reaches zero is an error that shows another green bar that I do not know where it came from, how can I fix this, or improve this code?
The link is this:
https://drive.google.com/file/d/0B-bh_e ... sp=sharing
the code is bellow.
Image
B
32
S
9
G
3
Posts: 280
Reputation: 4,262

Post » Tue Mar 01, 2016 5:50 am

Ok after watching the game for a little while here is what I see.
on spawn resets green life on all enemies, but not life thus making green bar reappear on death.
There needs to be some kind of for each statement to determine what is happening to each.
also I disabled everytick as it was not needed. per what I was reading in the code.
B
29
S
13
G
10
Posts: 355
Reputation: 8,327

Post » Tue Mar 01, 2016 5:17 pm

So with that code can I improve it?
B
32
S
9
G
3
Posts: 280
Reputation: 4,262

Post » Wed Mar 02, 2016 1:16 am

The problem is that there's no system in place to pair the enemies with the health bars. Whenever an enemy dies, the health bar is not destroyed and it's moved to another enemy (which can be seen in debug mode)

This can be easily fixed by using containers

I also did a little cleanup on the events. You can put the "find path" right after spawning the enemy, and the health bar positioning now happens every frame
https://dl.dropboxusercontent.com/u/3954039/Temp/Life_Bar_Defensis_1.0.0.capx
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Wed Mar 02, 2016 1:47 am

Thank you my friend,
7Soul
this worked perfectly, I still had no notion of using containers, it worked perfectly, was of great help.
B
32
S
9
G
3
Posts: 280
Reputation: 4,262


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 19 guests