Page 1 of 1

Creating a life value

PostPosted: Sun May 08, 2005 4:36 am
by Editor
Hi!

Lets say I had a main character in my game called player, and various spike traps called trap. In the game I have an actor called "life". What I want to do is have it so that the default value of life is 100, and whenever "player" collides with "trap" that number keeps decreasing by one until player comes off of the trap. But if "life" hits zero he dies. Does anyone have an idea on how to do this?

PostPosted: Mon May 09, 2005 1:15 pm
by makslane
In the life actor put this actions:

On Create Actor event, put this Script Editor action:
lifeCount = 100; (Create the lifeCount varriable in the Variables button)


In the player actor put this actions:

On Collision with trap event, put this Script Editor action:
life.lifeCount = life.lifeCount - 1;
if(lifeCount <= 0)
{
DestroyActor("Event Actor"); //Destroy the player
}