how to make a "go to next scene" button

on my app, it's based on levels. So once you beat my level, I have a scene that comes up, and on the scene I want to put my "go to next scene" button. But, it will only go to the next scene I have lined it up with in my scene selector. And if possible, I would like to avoid making a scene in between every level. If anyone would help me, I would really appreciate it. Thx.

Best Answer

  • CodeMonkeyCodeMonkey Posts: 1,803
    edited April 2013 Accepted Answer
    What you can do is have a boolean game attribute that when true it activates the Change Scene behavior to go to the next scene. The pause screen that you bring up when you beat a level, when you press the next level button it changes the game attribute to true and unpauses the game, returning you back to the current level. To make sure you don't leave the next scene as soon as you get there, put the Change Scene into a Timer that will run to completion after a very small delay. Outside of and after the Timer, change the game boolean back to false.

    The Button in the Paused Scene:
    Rule If touch is Pressed
    --Change Attribute game.GoToNextScene = true
    --Unpause Game

    In a control actor in any of the level scenes.
    Rule: If game.GoToNextScene == true
    --Timer After .01 Run To Completion
    ----Change Scene -> Next Scene
    --Change Attribute game.GoToNextScene = false

Answers

  • mounted88mounted88 Member Posts: 1,113
    Use the change scene behavior and select what level you want it to go to next
  • future_games_101future_games_101 Member Posts: 58
    yes, that would work for one scene, but I want the "go to next scene" button to be at the end of every level. And I don't want to have to make a scene in between every "level scene" I have.(if I only had one "go to next scene" scene, it would just go to the next scene that the scene was above).
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Since I don't understand what you wrote, let me start with an example. Let's say you have the following scenes:

    1. Menu
    2. Level 1
    3. Level 2
    4. Level 3

    On each scene, you would have a button with the rule: When Touch is Pressed --> Change Scene [next scene].

    So how is your setup different from that?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • future_games_101future_games_101 Member Posts: 58
    ok, let me explain lets say these are my scenes
    1.menu
    2.level 1
    3.level 2
    4.level 3
    5.pause scene( go to next scene)

    ok so on the pause scene (when you press the pause button(which is on every level)) It has a home button, a "reset scene" button, and a "go to next scene" button. and I am having trouble with the "reset scene" button and the "go to next scene" button. because when I press the reset scene button it only resets the pause scene. and when I press the "go to next scene" button it only goes to the scene that is after the pause scene. which in this case would be the menu scene
  • PaxPaxPaxPax Member Posts: 106
    edited April 2013
    Let me take a stab at this. I am not exactly sure what you mean when you say "...press the ' go to next scene' button...". I am assuming it is the 'change scene' behaviour. The change scene behaviour defaults to 'next scene'. However you can change 'next scene' to any scene you want. Once you have your 'change scene' behaviour in your actor(in your case you refer to a button actor), click on 'next scene'. You will then see a list of all your scenes. Simply click on the scene you want to change too. Hope this helps.

    cheers
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2013
    You need a game level attribute that track what the active scene you are on. You can use an INTEGR and number the scenes 1,2,3 et... When each scene starts have it change game.level to it's associated number. Then in your pause menu have a series of rules nested.

    In each scene have change attribute at start.

    Change attribute: game.level to 1,2 0r what the level number is. By using only one attribute it will overwrite for each level and you will never have a conflict as to what level is active.

    Rule for leaving pause.

    When touch is pressed

    Rule inside the touch is pressed rule.

    When game.level = 1

    Change scene to level 1

    OTHERWISE

    Rule

    When game.level = 2

    Change scene to level 2

    OTHERWISE

    Rule

    When game.level = 3

    Change scene to level 3

    Keep adding rules like this in each otherwise section.

    If you want the scene to reset like play again it's best to have a pop up at the end of a level failure to ask "Try Again" or something like that and do a when touch is pressed reset the active scene. Going to a pause menu then to a reset scene is not advisable as pause means pause current action. Have the reset in the active scene and give the player the option to either replay or quit to the main menu.
  • future_games_101future_games_101 Member Posts: 58
    ok , frying bacon studios you are helping me a lot but I am very new to gs and I don't know a lot . I hate to ask, but can you tell me how to do this and go into a lot of detail. like when you said I had to make a game level attribute. were do I make it? on the actor , game , or scene. sorry for the trouble but thanks
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Wow, I would recommend the videos as there is an extensive library of video made so that we don't have to go into detail every time someone has a question. Do a google search for gamesalad cookbook videos there you will find the answers about how to create attributes and use the behaviors.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    You can also head over to GSHelper.com - we have dozens of free video tutorials available on our site.
  • future_games_101future_games_101 Member Posts: 58
    thank you so much code monkey, you don't know how much you helped me out. And thank you for taking your time and going into grave detail. and I thank everyone else for trying to help also
Sign In or Register to comment.