using properties for enimies energy?

(TomorrowMan) #1

hi there, im working on a game, and im just a few weeks from completing it! But, i have one last question…my charecters and the bosses in the game have energy bars, and i have them worked out perfectly…but…in all the levels there are dozens and dozens of enimies to fight your way through (its a platformer;kinda like megaman), and theres no way in hell im gunna make all of them an energy bar offscreen or anything like that, that would take way to long…but, i once heard you could do energy with properties…so, how exactly can you get this to work?

(Fred_Pyo) #2

As far as i know:

an energy property (maybe an “int”)

Sensors on the enemies that detect when it is being fired at…

Collision —> AND —> Property
Bullet Add

Property —> AND ----> Edit Object
Equals end object (or some fancy logic bricks death)

Hope it’s clear
[Wonder how you did your life bars…]

(TomorrowMan) #3

oh, the energy bars? thats really simple actually! first you make the bar graphic in photoshop or gimp or whatever…then you put an invisible plane on one end with the property “die” or something like that…you have a small cube on the other end thats colored, so the user knows where it is…have the energy bar be an overlay scene…then once you get hit by a certain bullet or something, the charecter fires a message for the cube to move to the right so far(the cube doesnt respond to gravity ex. gravity 9.8, cube has -9.8 always force in the z direction)…you can even get into more complex behaviors like having different bullets/lasers move the cube more or less, and for bosses, have a second invisible plane a little bit before the last one, that gives a message to the boss to deliver a final last bid attack or something…its not that hard really…

(Fred_Pyo) #4

OH [!] … very clever…

[thought]So that’s why you didn’t know how to use properties for lives :slight_smile: [/thought]

It’s all clear now, did you get what I explained back up there?

(TomorrowMan) #5

yeah, yeah, and thanks for the help! :slight_smile: i figured it out…yeah, you can do some pretty cool effects with the energy bar system, plus the user can see how much life they have left…in the game im working on now, different enimies take off different amounts, and I even have health gems, that replinish health! pretty cool huh?

(Pooba) #6

The easiest way to do a health bar here: