Page 1 of 1

Pausing and Creating Actors... help please!

PostPosted: Thu Sep 20, 2007 1:50 am
by recklusfire1
I am trying, by script, to create a "paused" actor that appears on the "p" Key-Down Event, which is pause. So basically when the user presses "p", not only will the game be paused, but the word "paused" will appear on the screen as well.

The problem is that the code I have created works one way, and not the other. Yet, the one way it works is the opposite of what I want it to do. What happens is that the "paused" appears on unpause, and doesn't delete(destroy); you can simply think that... "Ooh, just switch the script around.." but that does not work.

Here is the script that DOES work, but not the way I want it to work:
Code: Select all
 

if(pause == 0)
{
    DestroyActor("Paused");
    PauseGameOn();
    pause = 1;
}

else
{
    CreateActor("Paused", "icon", "(none)", "(none)", -105, -41, true);
    PauseGameOff();
    pause = 0;
}



Here is script that does NOT work:

Code: Select all

if(pause == 0)
{
    CreateActor("Paused", "icon", "(none)", "(none)", -105, -41, true);
    PauseGameOn();
    pause = 1;
}

else
{
    DestroyActor("Paused");
    PauseGameOff();
    pause = 0;
}



Does anyone have any tips or answers to my problem?

Re: Pausing and Creating Actors... help please!

PostPosted: Fri Sep 21, 2007 12:20 am
by Rux
For this you'd need to make a timer. First parent the paused actor to the view. Then change the transparency to 100%.
Then on p create timer 50 milliseconds (change loop to 1) and on timer event choose whatever you made the time and choose script editor
Code: Select all
if(pause == 0)
{
     pause = 1;
     PauseGameon();
}
else if(pause == 1)
{
     pause = 0;
     PauseGameoff();
}

Then on p down event (no repete!) script editor
Code: Select all
if(pause = 0)
{
      //Change pause actors transparency to 0%\\
}
else if(pause == 1)
{
     //Change the transparency to 100%\\
}


Try it. DON'T TYPE ANYTHING IN THE // \\ OR IT WONT WORK