Energy bar

0 favourites
  • 8 posts
From the Asset Store
Animated Energy Portals, Barriers, and Power-Ups great for all types of games.
  • Hello to all, i would like to know, for my ennemies in all the level, how i can add an energy bar??

    When the player hit an annemy he have to hit him somes times before the ennemy die.

    I would like to have this kind of stuff for all the ennemies. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • Well the basic health bar concept is to adjust an object's width based on a variable. Perhaps when an enemy is hit, you could create an energy bar at that enemy's position. Maybe it could have fade behavior with fade in and fade out?

  • yes this is what i want, an energy bar who appears when the ennemy is hit :D but i dont know how to do that <img src="smileys/smiley8.gif" border="0" align="middle" />

  • This may or may not work, (I don't know too much about this)

    Step 1. Add a sprite that looks like a health bar.

    Step 2. Set up a variable named "Enemy Health" (or something) and set the number to whatever you want say 5 (so 5 hits and the enemy dies)

    Step 3. Assign the variable to your enemy sprite.

    Step 4. Go to your event sheet and select "System", select "Subtract from variable" (or whatever says subtract). Select the variable as "Enemy Health" and the number as 1.

    Step 5. Select the health bar sprite and add a fade behavior.

    Not sure how to do it but somehow you can assign it so it fades 1 every hit till it goes away completely after 5.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The trick is not to "fade" but to change the length of the sprite by either altering width or height

  • I've made a simple test:

    http://labgames.camo.com.br/enemies_hp

    http://labgames.camo.com.br/enemies_hp/enemies_hp.capx

    You need to improve the handle of the bar within more enemies on screen and put the origin point on left, if your bar sprite will have a border to have the "fill" effect...

    I'm still not used on how to add event like "On <object> created" and how to handle instances properly, otherwise i would have made a more complex example hehe.

  • Cassianno the capx is not working

  • This seems interesting.

    Cassiano: could you provide us a working .capx? Thank you!

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