Pausing and Creating Actors... help please!

Non-platform specific questions.

Pausing and Creating Actors... help please!

Postby recklusfire1 » Thu Sep 20, 2007 1:50 am

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?
recklusfire1
 
Posts: 3
Joined: Fri Sep 14, 2007 6:22 pm
Score: 0 Give a positive score

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

Postby Rux » Fri Sep 21, 2007 12:20 am

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
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest