Lives

Game Editor comments and discussion.

Lives

Postby cheesemonkey » Tue Apr 08, 2008 3:31 pm

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.
cheesemonkey
 
Posts: 6
Joined: Sun Apr 06, 2008 2:25 pm
Score: 0 Give a positive score

Re: Lives

Postby Kalladdolf » Tue Apr 08, 2008 3:50 pm

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 :)
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Lives

Postby j2graves » Tue Apr 08, 2008 4:24 pm

wouldn't that cause it to keep on getting lives once it is above 100?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Lives

Postby cheesemonkey » Tue Apr 08, 2008 4:59 pm

Yeah, once it gets to 100 if you collect any more capsules it makes a life for every capsule you pick up.
cheesemonkey
 
Posts: 6
Joined: Sun Apr 06, 2008 2:25 pm
Score: 0 Give a positive score

Re: Lives

Postby DilloDude » Tue Apr 08, 2008 11:47 pm

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;
}
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Lives

Postby cheesemonkey » Wed Apr 09, 2008 12:58 am

Cool, that helped a lot, thanks. :mrgreen:
cheesemonkey
 
Posts: 6
Joined: Sun Apr 06, 2008 2:25 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron