PauseGame change animation Problem

Talk about making games.

PauseGame change animation Problem

Postby Behdadsoft » Sun Jun 22, 2014 8:39 pm

Hi.

I wrote this script for pause game and change animation. but before change animation game paused can any one help me for fix this Problem?

Code: Select all
if (pause == 0)
{
ChangeAnimation("MenuBotton", "PlayBotton", NO_CHANGE);
pause = 1;
PauseGameOn();
}

else if (pause == 1)
{
    ChangeAnimation("MenuBotton", "PauseBotton", NO_CHANGE);
    pause = 0;
    PauseGameOff();
}
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: PauseGame change animation Problem

Postby skydereign » Tue Jun 24, 2014 3:46 am

This is because you need to have a frame delay so that the ChangeAnimation can actually happen. The common way to fix this is to use a timer and timer event. So where you currently have your PauseGameOn call you should put a CreateTimer function call. Set the time to be 13 ms and in the actual timer event put the PauseGameOn call.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: PauseGame change animation Problem

Postby digiot » Tue Jun 24, 2014 8:58 pm

That is a very interesting issue !
I always ask me, how the GE engine handles the different sizes of the animations,
from very tiny ones, up to fullscreen graphics.
Is there a scheme for it, depending on the size of the graphics, or are the
13 ms the general time, used for any graphical operation ?

Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

Re: PauseGame change animation Problem

Postby skydereign » Wed Jun 25, 2014 4:49 am

digiot wrote:13 ms the general time, used for any graphical operation ?

It's the smallest time increment a timer is allowed to have. The animation size has nothing to do with it, all the timer event is used for is to make sure the PauseGameOn triggers on the next frame, so that the ChangeAnimation can be resolved. At the end of the the frame the animations update, meaning the ChangeAnimation is able to happen.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: PauseGame change animation Problem

Postby digiot » Wed Jun 25, 2014 8:49 am

Ah, the 13 ms are the shortest timer you can have, ok.
But the timer is used to wait for the frame action, to be completed, in this case,
the ChangeAnimation.
And that is, what I'm curious about. Will more complex actions (e.g. MoveTo) or
actions with large graphics need a larger timer wait cycle ?

Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

Re: PauseGame change animation Problem

Postby skydereign » Thu Jun 26, 2014 5:15 am

Timers cannot resolve on the same frame as they are created. So no matter how long the frame the timer is created on is, it will not be resolved on the same frame. You can easily test this by using a large loop after creating a short timer. This means that it doesn't matter how complex the frame is (loading, looping, what have you) the timer event is guaranteed to wait at least a frame. And after checking it seems the smallest timer is actually 12ms, not 13.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: PauseGame change animation Problem

Postby knucklecrunchgames » Thu Jun 26, 2014 3:12 pm

skydereign wrote:
digiot wrote:13 ms the general time, used for any graphical operation ?

It's the smallest time increment a timer is allowed to have. The animation size has nothing to do with it, all the timer event is used for is to make sure the PauseGameOn triggers on the next frame, so that the ChangeAnimation can be resolved. At the end of the the frame the animations update, meaning the ChangeAnimation is able to happen.


I thought 12m was the smallest Image
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: PauseGame change animation Problem

Postby skydereign » Thu Jun 26, 2014 8:10 pm

knucklecrunchgames wrote:I thought 12m was the smallest Image

skydereign wrote:And after checking it seems the smallest timer is actually 12ms, not 13.

Indeed, I corrected myself.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: PauseGame change animation Problem

Postby knucklecrunchgames » Thu Jun 26, 2014 8:14 pm

skydereign wrote:
knucklecrunchgames wrote:I thought 12m was the smallest Image

skydereign wrote:And after checking it seems the smallest timer is actually 12ms, not 13.

Indeed, I corrected myself.


Oh so sorry sky. I didn't see that.
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: PauseGame change animation Problem

Postby Behdadsoft » Fri Jul 04, 2014 4:55 pm

Thanks skydereign. :D

+1
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest