Make a pause in the program

You must understand the Game Editor concepts, before post here.

Make a pause in the program

Postby cedrique » Sat May 07, 2011 9:55 am

Hello
I would put a pause in my script for more fluidity in a change of scenery from my "Pacman-test" ...
And I do not know how to do it!
I can knowledge in C, I learn at the same time as Game editor ...

If there is a need I can put the file so you can see where I am!

Thank you
cedrique
 
Posts: 2
Joined: Sun Jan 31, 2010 9:32 pm
Score: 0 Give a positive score

Re: Make a pause in the program

Postby savvy » Sun May 08, 2011 1:33 pm

use pauseGameOn(); and PauseGameOff(); to pause and un-pause. in order for you to make a fluid menu with pause you have to make special variables in each of the characters to hold their speed and direction etc until un-paused. to make a menu you simple have to make it so it pauses only when the menu hits a certain transparency.
this menu can contain things such as "continue", "main menu", Exit game". simple 1 click things as when pause game is on you cant have any visual movement.
(when you press P)
Pause=1;
(on the menus draw event)

if(Pause==1)
{
transp-=0.1;
if(transp<=0)PauseGameOn();
}
if(pause==0)transp+=0.1;

(on the continue button)
PauseGameOff();
pause=0;
menu.transp=0.1; //this remove possibility of re-pausing

any help?
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Make a pause in the program

Postby cedrique » Wed May 11, 2011 7:36 am

Thanks for your help !

This is not what I wanted to do ... but you taught me to do a Fading!
I just wanted to make a pause in the script which is a shift in the stock ...

So, I found how to do with the timer!
cedrique
 
Posts: 2
Joined: Sun Jan 31, 2010 9:32 pm
Score: 0 Give a positive score

Re: Make a pause in the program

Postby savvy » Wed May 11, 2011 3:06 pm

ah well, what can i do but try XD
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Make a pause in the program

Postby SuperSonic » Sat May 21, 2011 2:19 am

So how do "PauseGameOn" and "PauseGameOff" work? like, what does it pause and disable? :|
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Make a pause in the program

Postby skydereign » Sat May 21, 2011 7:21 am

PauseGameOn stops everything. Only events that end in exiting the game, loading another game, and unpausing the games work. I feel like I managed to get another event to trigger, but I can't seem to replicate it. That's why most people don't use PauseGameOn for more complex things.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Make a pause in the program

Postby SuperSonic » Sat May 21, 2011 2:08 pm

Aha, thanks :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Make a pause in the program

Postby savvy » Sun May 22, 2011 11:16 am

yeees, its awkward because it means you cant have any moving parts in pause menus or anything working apart from maybe... a mouse click.
best thing for graphical purposes is to make pause variables etc. and actually make it YOURSELF.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Make a pause in the program

Postby Jagmaster » Sun May 22, 2011 3:54 pm

savvy wrote:yeees, its awkward because it means you cant have any moving parts in pause menus or anything working apart from maybe... a mouse click.
best thing for graphical purposes is to make pause variables etc. and actually make it YOURSELF.

Someone needs to post a tutorial on this. I have no idea how to do this, and I'm sure there's lots of people like me who would like to learn how to make fancy pause menus with animations and such.
(Or maybe it's a well guarded secret :shock:)
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Make a pause in the program

Postby Game A Gogo » Sun May 22, 2011 6:58 pm

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#p48846

you 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 ):
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Make a pause in the program

Postby SuperSonic » Sun May 22, 2011 8:22 pm

But if "PauseGameOn" stops every event from working except the ones that end in "PauseGameOn" and "PauseGameOff", then if you wanted a menu with animated buttons then you could do this...
Code: Select all
MenuButton1 -> mouseover -> scripteditor

ChangeAnimation("Event Actor", "RandomAnimation", FORWARD);
PauseGameOn();

That way, you could have animated pause menus :P
Please correct me if I'm wrong :)
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Make a pause in the program

Postby lcl » Sun May 22, 2011 9:38 pm

SuperSonic wrote:But if "PauseGameOn" stops every event from working except the ones that end in "PauseGameOn" and "PauseGameOff", then if you wanted a menu with animated buttons then you could do this...
Code: Select all
MenuButton1 -> mouseover -> scripteditor

ChangeAnimation("Event Actor", "RandomAnimation", FORWARD);
PauseGameOn();

That way, you could have animated pause menus :P
Please correct me if I'm wrong :)

I'm not sure if this will work. You can try it though.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Make a pause in the program

Postby skydereign » Sun May 22, 2011 10:12 pm

Events that only work are events that end in PauseGameOff, LoadGame, or ExitGame.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Make a pause in the program

Postby savvy » Mon May 23, 2011 3:21 pm

here, this shows both a created pause AND a pausegameon/off, see what its like and take heed this: there are advantages and disadvantages of both.
http://dl.dropbox.com/u/9105634/pause%20tut.zip

savvy
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: Make a pause in the program

Postby SuperSonic » Mon May 23, 2011 8:06 pm

Haha, (thingsthethingmakes) XD Where did you get that from?^^
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Next

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest