Page 1 of 1

Game pauses before CreateActor

PostPosted: Thu Sep 15, 2011 6:23 pm
by EntropiaFox
Hello there, yet once again. :)

The game I'm working on is coming along fairly nicely, however, when working on menus and the pause/resume functionality, I noticed something peculiar.

Code: Select all
damageIndex = ~damageIndex; //Bitwise complement on damageIndex, but tilde won't show >:(
if(damageIndex)
{
    warpModeVar = ~warpModeVar; //Bitwise complement
    CreateActor("screen_blackscreen", "screen_black640", "view", "(none)", 320, 240, false);
    PauseGameOn();
}
else
{
    warpModeVar = ~warpModeVar; //Bitwise complement
    DestroyActor("screen_blackscreen");
    PauseGameOff();
}



The following code snippet is inside an actor in charge of creating a black screen when the game is in pause, however it would seem that the CreateActor function is not "fast enough", as the screen_blackscreen actor never appears to be created, or is simply not displayed (The game pauses/unpauses without it). Is it due to the way it works, or is it something else? What I was thinking is, CreateActor waits for the next frame draw to actually create the actor, as this never happens because the game is paused immediately after, it's never done. Can someone confirm this?

Re: Game pauses before CreateActor

PostPosted: Fri Sep 16, 2011 12:32 am
by skydereign
The CreateActor happens, the actor doesn't get drawn though because that only happens when gE starts going through the draw actor events. So essentially you want the actor drawn before you pause, but to do that you'd need a timer, or similar which would give the actor a chance to draw itself before pausing.

Re: Game pauses before CreateActor

PostPosted: Sat Sep 17, 2011 4:28 pm
by sonicfire
Exactly do it with a short timer e.g. 25-50ms. I just tried this yesterday and it works great so far.
Remember that any sound or music is cut off when you pause!