Page 1 of 3

Life

PostPosted: Thu Feb 04, 2010 10:24 pm
by Behdadsoft
Hello . would like for the player to do a few lives. When certain player to damage his vision of life is low. Thanks!

Re: Life

PostPosted: Fri Feb 05, 2010 1:10 am
by Bee-Ant
Do you mean Health ???

1. Make an integer variable called "health"
2. Player->Create Actor
Code: Select all
health=45;
//this is the start set code
//set 45 to any health point you want

3. Player->Collision->Enemy
Code: Select all
health-=3;
//this is the damaging code
//set the 3 to any damage value you want

4. Player->Draw Actor
Code: Select all
if(health<=0)
{
    //dying code here
    //use what action you want to use as the dying action
}

Re: Life

PostPosted: Fri Feb 05, 2010 10:19 am
by Superbeni
wouldn´t it be better to put the code for dying into the collision-code?

Re: Life

PostPosted: Fri Feb 05, 2010 11:52 am
by Bee-Ant
Superbeni wrote:wouldn´t it be better to put the code for dying into the collision-code?

Oh yeah, you can put it there too... :D

Re: Life

PostPosted: Fri Feb 05, 2010 8:42 pm
by Behdadsoft
Thank you. Please leave me a sample.

Re: Life

PostPosted: Sat Feb 06, 2010 4:10 pm
by Bee-Ant
Here, hope it helps

Re: Life

PostPosted: Sun Feb 07, 2010 5:42 pm
by Behdadsoft
Thank you my friend this is what I want.

Re: Life

PostPosted: Fri Feb 12, 2010 7:41 pm
by Behdadsoft
Hello
When your script I use in my game I can run and play with get this error message .

Re: Life

PostPosted: Sat Feb 13, 2010 2:11 am
by Bee-Ant
Hmm...
Are you sure you have made the variable???

Re: Life

PostPosted: Sat Feb 13, 2010 6:46 pm
by Behdadsoft
OK. I Forget this Work.

Re: Life

PostPosted: Sat Feb 13, 2010 7:14 pm
by Behdadsoft
I make in a game I'm exactly the same Space Invaders. But when my ship eats a bullet is completely destroyed. Please tell me the problem is work. Thanks

Re: Life

PostPosted: Sat Feb 13, 2010 7:26 pm
by Bee-Ant
The problem may be in your start health, or collision with bullet.

Try this :
1. Ship - CreateActor - ScriptEditor :
health=5;

2. Ship - Collision - Bullet - ScriptEditor :
health-=1;
DestroyActor("Collide Actor");
if(health<=0){DestroyActor("Event Actor");}

3. Make sure you have only 1 action for each event. Check it by click edit. See how much action you have in Collision event.

Re: Life

PostPosted: Sat Feb 13, 2010 10:32 pm
by Camper1995
I see its hard to explain something using internet.

Here is demo:
health.zip
(98.28 KiB) Downloaded 75 times


Press space to shoot.

CAmPeR :P

Re: Life

PostPosted: Sun Feb 14, 2010 9:14 pm
by Behdadsoft
Thanks, your help, but instead I had a problem and I need to remove part. I play almost one stage to have finished but you need help. First, I create a menu for your game, including
Load, save, New Game and Quit Game.
Second, after the loss of enemies automatically go to the next stage.
If I can help my game will be finished, because I do not know programming and would like to help you.
Thank you all

Re: Life

PostPosted: Mon Feb 15, 2010 3:41 pm
by Camper1995
Thats nice. I dont understand you what game are you talking about..?

But I must finish the game: CityBuilder 2oo9 (its 87% finished)

Then we can star new project... 8)

Do you want to see demo of saving game and score?

CAmPeR :arrow: :P