Replay Previous Scene?
Hello,
In my game when the player dies the game goes to a Game Over scene. On that scene I want to add a button to play the level they were just on again. The problem is that the Change Scene behavior does not seem to have that option. Its "Previous Scene" appears to be the scene just before it in the file.
Is there a way I can set some attribute to keep track of the level the person is playing when they die and offer them the option to go back to it?
Thanks.
Rich
In my game when the player dies the game goes to a Game Over scene. On that scene I want to add a button to play the level they were just on again. The problem is that the Change Scene behavior does not seem to have that option. Its "Previous Scene" appears to be the scene just before it in the file.
Is there a way I can set some attribute to keep track of the level the person is playing when they die and offer them the option to go back to it?
Thanks.
Rich
Comments
The easiest way to do this is to make the "Game Over scene" as a pause scene !
Then you can just do unpause scene to return to your last scene , reset it , done .
Hope it puts you in the right direction .
Roy.
Thanks
Rich
Have a boolean attribute, called ResetScene, set it to false...
You should have a level scene and then a SEPARATE scene that says Gameover, lets call this the Gameover Pause scene.
When you die, PAUSE the scene and tell it to go to Gameover Pause, then when you press Replay...Change Attribute "ResetScene" > TRUE then UNPAUSE GAME...in your current level have a rule that says, when ResetScene = true, change scene > the current scene(level) you are on. works perfectly, you will have to change the last one for each level you are on so it changes to the correct scene
Hope that makes sense to you
Game attribute - LevelBeingPlayed (integer)
Scene attribute - Level (integer) (This needs to be in every Level scene)
In each have a rule set somewhere, maybe an invisible actor (I tend to have a start up actor that sets and resets certain attributes):
Change attribute:
- LevelBeingPlayed = Level
When the level changes to the Game Over scene, set a rule in the replay button as follows:
Rule; when pressed:
If LevelBringPayed = 1, then Change Scene to "Level 1"
- Otherwise
- If LevelBringPayed = 2, then Change Scene to "Level 2"
- - Otherwise
- - If LevelBringPayed = 3, then Change Scene to "Level 3"
etc....
Now keep in mind, the more levels you have, the longer this list of rules becomes, and it can get confusing.
The great thing is you can use this to go to the next level if you have a "Level Complete" scene.
Just do this:
Rule; when pressed:
If LevelBringPayed = 1, then Change Scene to "Level 2"
- Otherwise
- If LevelBringPayed = 2, then Change Scene to "Level 3"
- - Otherwise
- - If LevelBringPayed = 3, then Change Scene to "Level 4"
etc...
By doing things this way, it means you do not need to create a "Game Over" scene for each level, and you can incorporate many things like unlocking the next level in the menu.
Hope this helps.
K
To go to the next scene, have a button with a rule; when pressed - Change Scene - Next Scene.
K
Rich