Creating a life value

Game Editor comments and discussion.

Creating a life value

Postby Editor » Sun May 08, 2005 4:36 am

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?
Game Editor is great... If only I could afford the full version...
Editor
 
Posts: 20
Joined: Fri Apr 22, 2005 7:32 pm
Score: 0 Give a positive score

Postby makslane » Mon May 09, 2005 1:15 pm

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
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest