Adapting a health bar to a cooldown bar

Get help using Construct 2

Post » Thu Dec 06, 2012 4:12 pm

Hi. In working on a test project, I have the following groups for "combat" (Space Bar to attack) and health variables for a ship's health and health bar:





I'd like to add a cooldown system, wherein players can only fire every 3 seconds. My question is how to take advantage of the groups and events I already made. Whereas the health drops in increments (10 per enemy attack/collision), I'd like the second bar to show the max cooldown period (as in, the bar is filled), reduce it to 0 when the gun is fired, then climb back to the top every second as the gun cools off and returns to its original value.

While there are several ways to do cooldown (I've been testing two recently), I'm really not sure how to adapt them to my project. A simple one would be:



Though whether with this or a different one, I wouldn't know where to begin (other than start by writing them).bergmark2012-12-06 16:12:48
B
8
Posts: 24
Reputation: 638

Post » Thu Dec 06, 2012 4:29 pm

Your images are broken.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Thu Dec 06, 2012 5:10 pm

I can see them just fine ;_; Myabe it's a problem with the website? Try right-clicking and choose "View Image".bergmark2012-12-06 17:12:02
B
8
Posts: 24
Reputation: 638

Post » Fri Dec 07, 2012 9:16 pm

Ok. I'm... halfway there. Here's what I got so far: the cooldown bar will steadily decrease toward a "zero" point on the gauge, and once the "cooldown" is reset, the bar will fill the gauge again, telling players they can shoot again.

Unfortunately, the bar is popping up outside and above the gauge. Here's a *.capx truncated just to show the essential:

http://www.mediafire.com/download.php?4wu49j4j527cq76

PS: And an image too:

bergmark2012-12-07 21:19:09
B
8
Posts: 24
Reputation: 638

Post » Fri Dec 07, 2012 9:33 pm

try something like:

System every tick> hp image bar : set width to (player.health/10) * 120

Play with the values after health to modify the width.
Image
B
29
S
5
G
1
Posts: 125
Reputation: 3,174

Post » Fri Dec 07, 2012 10:06 pm

Many thanks, LW, it works Ship.Cooldown/10 * 720 did it - and I *think* I realize what I did wrong and you did right. On the other hand, since I still wasn't happy with the direction, I simply replaced the green cooldown bar with an entirely black one. This way, the green ("full") bar is visible when the player can shoot, while the black one will perform that scrolling motion, making it seem like the guns are powering up ^__^

I hope to have this project ready to make available at the forums sometime this weekend, or early Monday. Thank you once again :)
B
8
Posts: 24
Reputation: 638


Return to How do I....?

Who is online

Users browsing this forum: WhosWho and 17 guests