Page 1 of 1

PauseGame change animation Problem

PostPosted: Sun Jun 22, 2014 8:39 pm
by Behdadsoft
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();
}

Re: PauseGame change animation Problem

PostPosted: Tue Jun 24, 2014 3:46 am
by skydereign
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.

Re: PauseGame change animation Problem

PostPosted: Tue Jun 24, 2014 8:58 pm
by digiot
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 !

Re: PauseGame change animation Problem

PostPosted: Wed Jun 25, 2014 4:49 am
by skydereign
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.

Re: PauseGame change animation Problem

PostPosted: Wed Jun 25, 2014 8:49 am
by digiot
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 !

Re: PauseGame change animation Problem

PostPosted: Thu Jun 26, 2014 5:15 am
by skydereign
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.

Re: PauseGame change animation Problem

PostPosted: Thu Jun 26, 2014 3:12 pm
by knucklecrunchgames
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

Re: PauseGame change animation Problem

PostPosted: Thu Jun 26, 2014 8:10 pm
by skydereign
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.

Re: PauseGame change animation Problem

PostPosted: Thu Jun 26, 2014 8:14 pm
by knucklecrunchgames
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.

Re: PauseGame change animation Problem

PostPosted: Fri Jul 04, 2014 4:55 pm
by Behdadsoft
Thanks skydereign. :D

+1