Game pauses before CreateActor

Non-platform specific questions.

Game pauses before CreateActor

Postby EntropiaFox » Thu Sep 15, 2011 6:23 pm

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?
EntropiaFox
 
Posts: 10
Joined: Sat Jul 02, 2011 3:57 pm
Location: Somewhere, having issues!
Score: 1 Give a positive score

Re: Game pauses before CreateActor

Postby skydereign » Fri Sep 16, 2011 12:32 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Game pauses before CreateActor

Postby sonicfire » Sat Sep 17, 2011 4:28 pm

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!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest