Page 1 of 1

question about events

PostPosted: Sat Apr 11, 2009 1:13 am
by sillydraco
well i was trying to figure out how i would do lives and a game over screen, is there a way activate an event when another event A (collision with baddie -> destroy actor Player) occurs once, and activate a different event when event A occurs the second time, and the third, etc? basically im looking for something simple that i can use for other things too, such as limiting jumping and making floors only able to be walked on three times before destroying themselves.

Re: question about events

PostPosted: Sat Apr 11, 2009 1:25 am
by skydereign
Variables. You can make them one of two ways. But you will need to start using script editor if you don't already. But scripting will allow you to do almost anything you want to do. There is a button at the bottom left of the script editor that adds variables. You would create an int. You can then use this int (basically a number), and change it and reference it. I prefer to declare them in global code, also found at the bottom of the script editor, or the top of gE. If you are using global code, put this in,
Code: Select all
int VAR;

VAR would be the name of the integer you are using. So in this case it is just a count that you would increase upon destruction. So at the trigger of A, increase it. And since A occured and VAR was 0, do event, if VAR is 1 do other event.
Code: Select all
if (VAR==1)
{
    // put code here, so you know // comments code, meaning it does not look at code behind the double slash
}


I think this may be achieved through activation events, but you will still need a variable to record how many events have happened. Sorry if this wasn't that easy to understand... I can try again if you wish.

Re: question about events

PostPosted: Sat Apr 11, 2009 1:36 am
by sillydraco
thanks! is there a place that lists the actual code of each event? like there is the changeanimation one, and im guessing there is one for each event to put in script editor!

Re: question about events

PostPosted: Sat Apr 11, 2009 1:55 am
by skydereign
Yeah, the second button from the left will give you all the functions you use, or most of them anyway.

Re: question about events

PostPosted: Sat Apr 11, 2009 2:05 am
by sillydraco
wait, the second button from the left...in the Game Editor? because that would be Add Actor :3

Re: question about events

PostPosted: Sat Apr 11, 2009 3:14 am
by skydereign
No, when you add an event, then set it to script editor, the button called variables/functions. Using script editor instead of single events, you can add as many events as you want. An example being, you might be used to doing keydown change animation and keydown, moveto. Instead those can both be in the script editor. All of the functions can be used there. Just find it and use it.

Re: question about events

PostPosted: Sat Apr 11, 2009 3:18 am
by sillydraco
aha i see! thanks! this makes things sooooo much easier :D