Health Bar Issue

For questions about using Classic.

Post » Mon Dec 22, 2008 11:24 am

I did not like the way some of the previous health bars I created looked so I tried a new method. I created 35 animations of the health bar and just trimmed a tiny bit off of the right edge each time. Here is what I set:

-global variable "health" 98 or greater --->animation "health decrease"
--->animation set frame 1

-global variable "health" equal to 97 --->animation "health decrease"
--->animation set frame 2

-global variable "health" equal to 96 --->animation "health decrease"
--->animation set frame 2

and so on.....(I pretty much just guessed how big the health bar would look at the current "health" variable and set "equal to" on every number from 0-100)

The problem is that after some damage is dealt, frame 1 (FULL health) disappears completely and no other frames are ever set. I will try to upload a sample of what is happening later in the day.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Mon Dec 22, 2008 11:33 am

I just found out that the frames do not completely disappear. The animation frames change position on the X and Y coordinates down and to the left until I can't see them.... even though I have the X and Y coordinates set and for that particular layer scroll is disabled...weird.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Mon Dec 22, 2008 11:37 am

Why not just put your full health bar image in a Tiled Background and decrease the width? That'd be so so much easier than this system.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon Dec 22, 2008 11:53 am

I've posted an example of several types of health bars here:

viewtopic.php?f=16&t=2196

Let me know if this doesn't do what you want.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon Dec 22, 2008 2:40 pm

You could just make a bar and set the width smaller and smaller as you get hit more and more.
Ive used this in a few games and it looks really nice.

Make a private variable "health"

and set the width of the bar to always equal to health.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Mon Dec 22, 2008 7:29 pm

[quote="Rich":31oxyy00]Why not just put your full health bar image in a Tiled Background and decrease the width? That'd be so so much easier than this system.[/quote:31oxyy00]

I tried that way already and I just wanted to compare it to my other method. After messing around with health bars for a day I would have to say that Rich's example is probably the easiest and it can look good too. It's a pain to make a ton of animations. Thanks for the examples Rich :)

By the way, I found out why the frames were moving around. It was because I did not set a hotspot for each frame!!! SIMPLE mistake.
B
2
G
4
Posts: 16
Reputation: 1,082


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests