HP

From Game Editor

Revision as of 01:10, 27 July 2009 by Skydereign (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Health points or some equivalent are used in almost every game. In gameEditor, HP is very easy to set up. In a lot of games, HP is used and shown in a bar. Other games have just internal HP that when reduced to 0, destroys the actor. Either way, the game requires the storing of HP. To do this you must create a variable. For a game that requires many enemies, or lots of objects that would have an HP like variable, it is better to use actor variables. This way, each actor can have its health independent from everything else. When dealing with actor variables, it is helpful to know the special actor types as well as actor variables in general.


After creating an actor variable called HP, what you need to do is implement the maintenance of HP. For this example, HP, will be lowered upon collision with the actor bullet. But before even that, you must set the HP value. Since variables are set to 0 by default, you must add a create actor event setting the HP value.

Enemy -> CreateActor -> Script Editor

HP=10;


For the reducing of HP, you would add the collision event with bullet. In some games it is more efficient to have the bullet hold the event, instead of collision. This is dependent on the max number of bullets and max number of enemies. If there will be a larger number of bullets, like in most SHMUPS, then you would put this event on the enemy actor.

Enemy -> Collision(bullet) -> Script Editor

HP--;
DestroyActor("Collide Actor");
if(HP==0)
{
    DestroyActor("Event Actor");
}


This event first decrements HP, and then destroys the bullet, Collide Actor. Then, if HP is 0, destroy the enemy, Event Actor.


Some examples of actors that would use HP.

  • Main Character
  • Enemies
  • Destroyable walls
  • Missiles
  • Buildings
Retrieved from "http://game-editor.com/HP"