No secrets in GE should be well guarded!
You just have a variable named like "Paused", when it's 0, the game goes, when it's 1 the game stops!
But how to make the game go and stop? easy!
familiar with if()? and else?
Either way, if(condition) checks if condition is true, condition can be check with things like: == equal, > greater, >= greater or equal, < less, <= less or equal, != not equal.
more information:
viewtopic.php?f=1&t=6834&p=48846#p48846you can use else after an if statement to make something happen when the condition is not met.
so in every event that involves movement of your actor, you'll now add an if statement to it, and maybe some else too.
like say on key down:
- Code: Select all
if(Paused==0)
{
x+x=10;
}
Make sure to do it on all the movement involved actions in all moving actors!
You'll also need to create three actor variable, PauseT, lxvel and lyvel. Make sure they are
actor variables! These variable will be to regain motion after pausing, since we want them to freeze up, any xvelocity and yvelocity would be set to zero. Not with me!
In draw actor you'd need:
- Code: Select all
if(Paused==1)
{
if(PauseT==0)//Makes this piece of code happen only once when paused!
{
PauseT=1;//With this...
lxvel=xvelocity;//Storing current speed before stopping the actor
lyvel=yvelocity;
}
xvelocity=0;
yvelocity=0;
}
else
{
if(PauseT==1)//Makes this piece of code happen only one when unpaused!
{
PauseT=0;//With this...
xvelocity=lxvel;//Retrieving speed before pausing, so there is no game-play lost!
yvelocity=lyvel;
}
}
Hopefully this helps.... I know it's not very detailed ):