restore, restart and quit

Started by Kimbra, Fri 28/10/2011 12:10:07

Previous topic - Next topic

Kimbra

well.. the game I'm working on has only 3 rooms:

R1 Starting room
R2 The game
R3 Death Room

I created three objects in the death room for restart, restore and quit functions.
my question is: should I copy/paste their code from global? I'm afraid the restore may have bad effects later???

help  ???

Arjunaz78

Did you mean GUIs or Object?and why you need to copy/paste from Global script instead of room script?

for what i know..global script for whole your game action script,if you only want the effect just to your room only,just edit the room script instead of global script..don't just copy/paste the code,or you can finally facing a doubling same script/function or make conflict with room script & global script..

correct it if im wrong..
..In the making of Silent Hill: The Hospital..

https://www.facebook.com/ArjunazGamesStudio

AnasAbdin

kimbobo could you explain more?

correct me if I'm wrong... you want to make a 'death' room with three gui buttons or objects to restore, restart and quit game?

in this case, create the three objects. Go to their events list and put the code in 'Anyclick on object'...
the code can be as simple as that (assuming the button names are Restore, Restart and Quit)
Code: ags
function restore_AnyClick()
{
 RestoreGameDialog();
}

function restart_AnyClick()
{
 RestartGame();
}


for the quit button, if you want a confirmation dialog when clicked do this:

Code: ags
function quit_AnyClick()
{ 
  gPanel.Visible = false;
  Wait(1);
  QuitGame(1);
  gPanel.Visible = true;
  gIconbar.Visible = false;
  mouse.UseModeGraphic(eModePointer);
}


I'm not sure what cursors you use in your single room game, but if you want to disable or change cursors they are as easy as:
Code: ags
mouse.UseModeGraphic(eModePointer);
mouse.DisableMode(eModeLookat);
mouse.DisableMode(eModeTalkto);
//.........


by the way, the code above are taken from the global script. I'm sure someone will soon notice your thread and laugh at me hehehhe

Kimbra

Arjunaz78: thank you I won't copy paste anything :)

AnasAbdin: Woohoo! That's exactly what I wanted!  :-*  :-*  :-*  :-* and  :-*

SMF spam blocked by CleanTalk