Adapting a health bar to a cooldown bar

0 favourites
  • 6 posts
From the Asset Store
Health, Weapon & Rage Bars for your Games. Easy to use & Customize.
  • 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:

    <img src="http://s18.postimage.org/9l8rfx5yv/image.png" border="0" />

    <img src="http://s18.postimage.org/4nv6ut3zr/image.png" border="0" />

    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:

    <img src="http://s18.postimage.org/646pcy6wn/image.png" border="0" />

    Though whether with this or a different one, I wouldn't know where to begin (other than start by writing them).

  • Your images are broken.

  • I can see them just fine ;_; Myabe it's a problem with the website? Try right-clicking and choose "View Image".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    mediafire.com/download.php

    PS: And an image too:

    <img src="http://s10.postimage.org/igdn9te6f/Untitled_1.png" border="0" />

  • 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.

  • Many thanks, LW, it works <img src="smileys/smiley4.gif" border="0" align="middle" /> 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 :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)