pausing the game while displaying a main menu

Game Editor comments and discussion.

pausing the game while displaying a main menu

Postby biffo » Sat Jun 21, 2008 9:11 pm

[img]OK, I get how to make a pause menu using PauseGameOn()/Off(),
but my issue is how do I make a menu that has some elements that are still dynamic, (IE recieveing events, and updating screen position like a menu cursor,) while the gameplay elements are all frozen?
PauseGameON() seems to only be good for pausing every actor in the game. Am I incorrect?
are actors created after PauseGameON() is called still updatable?
is their a way to exclude a few 'special' actors from the PauseGameOn() function?

conversely, is there some way to pause the timer on an actor completely?
EventDIsable is a good start but my physics continue to operate on a DrawActor basis
TIA
Attachments
screenshot2.jpg
gameplay
screenshot1.jpg
main menu
biffo
 
Posts: 3
Joined: Sat May 17, 2008 7:51 pm
Location: S.F.
Score: 0 Give a positive score

Re: pausing the game while displaying a main menu

Postby Bee-Ant » Sun Jun 22, 2008 7:59 pm

This is quite dificult.you need to stop all moving object except your menu by EventDisable,make their directional_velocity to 0,or using variable while you pause the game.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: pausing the game while displaying a main menu

Postby Fuzzy » Sun Jun 22, 2008 10:19 pm

Make a global var called PauseActors of type integer. in your menu have a pause button that flips the value of that variable between zero and one.

in the beginning of the draw event for each actor put
Code: Select all

if (PauseActors ==1)
{
    EventDisable("Event Actor", EVENTALL);
}
else
{
    EventEnable("Event Actor", EVENTALL);
}
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: pausing the game while displaying a main menu

Postby Bee-Ant » Mon Jun 23, 2008 5:55 am

But Fuzzy,can you make able all events after you disabled all events by that actor itself.i dont think so...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: pausing the game while displaying a main menu

Postby DST » Mon Jun 23, 2008 6:33 am

Bee ant has a point. Won't that disable the draw actor too?
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: pausing the game while displaying a main menu

Postby Bee-Ant » Mon Jun 23, 2008 6:45 pm

Theres no way except disable the specific events,directional velocity,and animation direction.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: pausing the game while displaying a main menu

Postby biffo » Tue Jun 24, 2008 7:40 am

This sounds like it should work. I'll try it tomorrow night.
Thanks fellas! wish me luck.
biffo
 
Posts: 3
Joined: Sat May 17, 2008 7:51 pm
Location: S.F.
Score: 0 Give a positive score

Re: pausing the game while displaying a main menu

Postby biffo » Wed Jun 25, 2008 5:54 am

So it looks like Bee ant is right.
Allthough calling event disable on the draw actor doesnt' seem to stop the actor from drawing FYI
conversely even before I tried this I thought of attaching the eventdisable call to the menu thinking the menu at that point could contain the calls to disable the active sprites.
Alas this didn't as Bee pointed out stop the velocity and drawing from updating.
Niether did calling the event disable on the timer which kind of suprised me. I suppose at this point the bulletproof solution would be to pass all the velocity to holder variables and zero them out.
I thought according to what I read though that creating sprites after the PauseGameOn would still work. Shouldn't they? It doesnt seem to....
Still looking for an elegant solution.
thanks for everyones feedback.
possibly write one function in global script that handles storing all the dynamic elements velocitys and then zeroing them out,
then a second one to reload the velocitys?
biffo
 
Posts: 3
Joined: Sat May 17, 2008 7:51 pm
Location: S.F.
Score: 0 Give a positive score

Re: pausing the game while displaying a main menu

Postby Bee-Ant » Wed Jun 25, 2008 8:04 am

Well,thats the hard point "restoring the value". I use this to pause my player
Code: Select all
directional_velocity=0;
EventDisable("Event Actor", EVENTANIMATION);
EventDisable("Event Actor", EVENTCOLLISION);
EventDisable("Event Actor", EVENTKEYDOWN);
EventDisable("Event Actor", EVENTKEYUP);
EventDisable("Event Actor", EVENTTIMER);
ChangeAnimationDirection("Event Actor", STOPPED);

Use this code for AnyActor>Keydown>PauseKey>ScriptEditor
To unpause them...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: pausing the game while displaying a main menu

Postby DST » Wed Jun 25, 2008 2:20 pm

Feral, I think it's time for you to make us another demo...... :lol:
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: pausing the game while displaying a main menu

Postby Bee-Ant » Wed Jun 25, 2008 2:33 pm

Why you asked for feral DST?you said you like making game...even 10 mins after wake up...lol
Oops,is that a secret?
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: pausing the game while displaying a main menu

Postby feral » Wed Jun 25, 2008 10:18 pm

DST wrote:Feral, I think it's time for you to make us another demo...... :lol:



um yeah... thanks mate...'cough'...

actually...well I did have a quick go at a solution, but, it has to sacrifice a complete game "frame" to un-pause, so would be useful for somethings, others like fast action, may get a bit difficult. but it does stop all action ( except timers so these can't be used with this method .......... mmmm.. just thought ...unless you reset them after pause :? will look at that ( tho i hate timers )

anyhow, everything pauses, using one function, and no need to do things to all actors like event disables or stuff, and then the advantage is you can still do menus, jump to help screens etc...but at the cost of a frame of game action..

in other words you need to access the view's "draw feature" ( so game goes ahead one frame) and if you mess around in the menus - then every click or menu action needs another draw frame ... i didn't like the method much so gave up until i could think of something better,... but it works sort of

would that be worth a demo of ?

basically it goes

on key down "p"
pause=1

then in view draw

while (pause==1)
{
// menu code until pause=0
}


feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: pausing the game while displaying a main menu

Postby makslane » Wed Jun 25, 2008 11:21 pm

This while will freeze the game.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: pausing the game while displaying a main menu

Postby feral » Thu Jun 26, 2008 1:50 am

makslane wrote:This while will freeze the game.


oops i may have said it wrong..

demo shortly

feral
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: pausing the game while displaying a main menu

Postby feral » Thu Jun 26, 2008 2:11 am

ok..

sorry, I misspoke ..

the while loop is in a function in global, however it can switch back and forth to the view draw using "flags"

if pauseon=1 do global loop

depending on which key pressed reassign pauseon with new flag, do one screen refresh ( using view) then if required return to while loop ( ie: the menu options)

if unpaused selected escape loop by setting pauseon flag to 0

left-control key to pause
while in menu
h for help
r to return to menu
u to unpause

main pieces of code are
left-control key down - sets pauseon to flag 5
some code at the start of draw view
and the rest is a function in gloabl..

it is all very rough, as i said i wasn't completely happy with it....

sorry for the biggish download, but i was testing it on a game of mine

feral

PS: is also unfinished because each draw refresh CAN write to the current view ( which may be the help screen at the time... becuase currently the view changes to anothe area to display help..

I just didn't get that far to look into it.. BUT the easy solution would be to have a menu and help screen that covered up the current game view, so any redraws happened in the right place but not be seen..
Attachments
pause.zip
ged and data files for a rough pause menu
based on an old game of mine
(1.8 MiB) Downloaded 116 times
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron