You mean like pressing escape?
Go to the settings place where you can change the resolution and all that, you should see an option to disable the escape button, make sure you disable the ESC button to escale. Now, go to the view actor and go to Events -- Add -- KeyDown -- Esc -- Script Editor and place in this code.
But first: Go to Variables, click ADD, and make it like this:
Make sure array is set to yes and value is 4
now heres the code that should go in
- Code: Select all
//replace the text
//player with your players name
playerVars[0]=player.x;
playerVars[1]=player.y;
// ^ Saves the players X and y
playerVars[2]=view.x;
playerVars[3]=view.y;
// ^ Saves the views x and y positions
saveVars("gameSave.sav", "posiSave");
ExitGame();
;
Now when you press escape you can exit the game and save the variables too
I'm pretty sure you know how to load the variables right? If not let me know and Ill explain.
Actually I'll go ahead and explain it.
Alright, you know how we have playerVars[0]=player.x? When you load a variable, you have to reverse it, so it looks like this instead. player.x=playerVars[0]. So therefor, on the view, go to create actor and put in this code:
- Code: Select all
loadVars("gameSave.sav", "posiSave");
player.X=playerVars[0];
player.y=playerVars[1];
// ^ Loads the players X and y
view.X=playerVars[2];
view.y=playerVars[3];
// ^ Loads the views x and y positions
There might be spelling errors, so make sure everything is correct before getting excited and just copying and pasting ;P
Please make sure you actually read this xDOtherwise you'd end up confused o.o