Adding timer to the game?

Started by HaReL, Fri 10/08/2007 13:28:35

Previous topic - Next topic

HaReL

I want to make a room , that after 3 seconds (for example), it will pass to the next room.
How do I do it?
Thank U in advance... ;)

Akatosh


strazer

HaReL, what do you want to do exactly? Is it a cutscene or is the room interactive? More info please.

HaReL

I want to do cutscene.. after you do somthing, a screen with "After Few Hours" appear, and then you in move to another room...

I've tried the link that Akatosh gave me, but it didnt work... :-\

Khris

In the room with the message, put this in "player enters screen (after fadein)":

Code: ags
  Wait(GetGameSpeed()*3);  // 3 seconds delay
  player.ChangeRoom(x);  // put the new room number here instead of the x


The player isn't supposed to interact with stuff anyway, so you don't need a timer to do it. Just call Wait to block the game for a couple of seconds, then load the next room.

Wait is blocking, so if you didn't use a transparent sprite for the wait cursor, it will show.
If you don't want this, hide the mouse in "player enters screen (before fadein)".
Just call "mouse.Visible=false;".

Do the same in the following room but set it to "true" to make the mouse visible again.

HaReL

#5
well, thanks for the response, but i didn't understand so well.
How do i do the "player enters screen"?

i've search in the help, but the only thing i found is

Code: ags
on_event (EventType event, int data) 
Called whenever certain game events happen. 
...
eEventEnterRoomBeforeFadein
      called just before room Player Enters Room event is run.
      DATA = new room number


and I understand that this go to the global script, not into the room...

if you can explain me again how to do this exactly, it will be great.. ;)


HaReL


SMF spam blocked by CleanTalk