Page 1 of 1

Lives

PostPosted: Tue Apr 08, 2008 3:31 pm
by cheesemonkey
I am making a game where if you collect 100 energy capsules you get an extra life, I have all the text actors to do it but I am not sure how to do it.

Re: Lives

PostPosted: Tue Apr 08, 2008 3:50 pm
by Kalladdolf
Player -> collision, any side of energy capsule ->
script editor:
Code: Select all
Capsule += 1; // the "Capsule" is an integer variable which you create yourself
if(Capsule > 100)
{Lives += 1;} // the same goes for "Lives"


and you can let the text actors display the variables.
for example:
Code: Select all
Capsuletextactor.textNumber = Capsule;

hope that helped :)

Re: Lives

PostPosted: Tue Apr 08, 2008 4:24 pm
by j2graves
wouldn't that cause it to keep on getting lives once it is above 100?

Re: Lives

PostPosted: Tue Apr 08, 2008 4:59 pm
by cheesemonkey
Yeah, once it gets to 100 if you collect any more capsules it makes a life for every capsule you pick up.

Re: Lives

PostPosted: Tue Apr 08, 2008 11:47 pm
by DilloDude
You can put
Code: Select all
Capsule - 0
and it will reset the capsule count, making a loop type thing, or if, you want to keep getting more and every hundred get an extra life, make a new variable, which at the start is set to 100. When you collect a capsule, compare with this variable instead of one hundred, and increase it when you get the extra life:
Code: Select all
Capsule ++;
if (Capsule >= lifeScore)
{
    Lives ++;
    lifeScore += 100;
}

Re: Lives

PostPosted: Wed Apr 09, 2008 12:58 am
by cheesemonkey
Cool, that helped a lot, thanks. :mrgreen: