Replay Previous Scene?

richcoyrichcoy Member Posts: 211
edited November -1 in Working with GS (Mac)
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

Comments

  • POMPOM Member Posts: 2,599
    Yes its possible ,
    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.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    In the Change Scene behavior, there should be a drop down list of all the scenes that are currently created. You select that scene from the list and you're good to go.
  • richcoyrichcoy Member Posts: 211
    I'm a little confused, each game level will need a separate "game over" so that the game knows which level they are on? Is there a tutorial/video someplace explaining this process?

    Thanks

    Rich
  • MattGibbardMattGibbard Member Posts: 45
    Once the player dies, spawn an background and a set of buttons which will be an overlay over the actual game scene. If the reset button is pressed, just use a 'Reset Scene' behavior.
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    @richcoy Here's how I do it:

    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
  • floydianspiralfloydianspiral Member, PRO Posts: 308
    floydianspiral said:
    @richcoy Here's how I do it:

    Have a boolean attribute, called ResetScene, set it to Change Attribute > false in a rule somewhere on the scene
    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

  • akstudiodevelopmentakstudiodevelopment Member Posts: 93
    Another option would be as follows:

    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
  • akstudiodevelopmentakstudiodevelopment Member Posts: 93
    MattGibbard said:
    Once the player dies, spawn an background and a set of buttons which will be an overlay over the actual game scene. If the reset button is pressed, just use a 'Reset Scene' behavior.

    Now that I think about it, this seems a lot easier and tidier!

    To go to the next scene, have a button with a rule; when pressed - Change Scene - Next Scene.

    K
  • richcoyrichcoy Member Posts: 211
    Thanks for all your help. That got me on the right track.

    Rich
Sign In or Register to comment.