Restart

triton13triton13 Member Posts: 161
edited February 2012 in Working with GS (Mac)
Hey guys, how can I set it up so that when I fail a level, it restart that level when you hit restart? I have the button and everything setup and but I don't know how to make it reset the level because if I have it do previous scene, it obviously goes to the one before. Also when I do hit restart and it goes to the level before, I found a glitch in my game. I kill all the enemies and it doesn't go on to the next level unless I back out of preview and restart the whole game. What's up with that? One more thing, how can I make a menu that it shows all my levels and the locked ones have a lock on them and if you play the game and beat the level, it automatically saves it and unlocks it so if you get out of the game and start the game back up, it will show it's unlocked in the level scene. Thank you

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    1. Use a "Change Scene" behavior, and select that same level.

    2. I'm not sure what you mean exactly, but if the script is not working right to change scenes in the first place, and you go back to another level when you click the button that isn't working right, and it's suddenly glitchy, it's because the game is not set up to flow in that manner. Some attributes may not be getting reset, or even firing off correctly.

    3. Not an easy thing to describe in a post, but basically you would set up boolean attributes that are triggered to say true or false depending on if the player successfully completes a level, and then having rules in the menu that respond to those true or false statements. Best thing is to go to GShelper.com, and download tshirtbooths free menu templates, and check those out.
  • for the level reset id do this
    this goes inside the reset actor

    Image and video hosting by TinyPic

    If anyone else has a better way to do this, please post as it would also help me :D
  • triton13triton13 Member Posts: 161
    How do I change the attributes back to their original state if the level resets?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi @David_GryphonsRealm & @triton13, bu using the Reset Scene behaviour, that resets all of that scene's attributes back to their original state, so there's no need to change the scene's attribute back by hand.

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • triton13triton13 Member Posts: 161
    Okay, so I have my scene setup, I lose and it's game over. When I lose, I set it up so it goes to my game over scene. On that scene, it says restart. On my restart button actor, I made a rule that says when it receives touch is pressed then reset this scene. It doesn't work =(
  • 921creative921creative Member, PRO Posts: 140
    Because it's trying to reset your game over scene rather than the scene where the game play is. Create a boolean attribute "Reset". Have a rule at the beginning of your game scene that says If Reset is true, reset this scene, then set Reset to false. Make sure the "restart" button changes the Reset attribute to true before you change back to your game scene.
  • triton13triton13 Member Posts: 161
    I'm confused. I made my attribute and I'm not entirely sure what to do now. I made an actor and put in the attribute Reset is true. Now what?
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    edited February 2012
    Try this - In you restart button actor in the "Game Over" scene, try using a "Change Scene" behavior, and select the scene you want to go to from the drop down. It'll be that simple.

    The only thing you may have to do is set some attributes back to whatever they were when you started the level originally, like the score and whatnot. Everything else will reset to it's original state.

    I have issues with reset scene from time to time, and using change scene has been easier to deal with. And using reset scene has to be used in the scene you want to reset, so It won't work for you since you are in another scene for the game over screen.
  • triton13triton13 Member Posts: 161
    But if you think about it, wouldn't that get annoying if you were into a game and you lose then you have to drop down and box and find your level instead of just hitting restart. I understand what you're saying and yes, it would be much easier for me to do that. But I want to make it easy for the user, you know what I mean?
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    The user won't know the difference. What I meant for the drop down was the scripting you are doing with GameSalad - That's what you would do in GameSalad to get it working - The user won't have a drop down, they just hit restart, and the level will restart for them like you are wanting.
  • triton13triton13 Member Posts: 161
    Alright, but I tried what you said before and I just didn't have it so it reset the attributes. I don't know how to do that. Also, would I have to make the same menu then for every single level if I do the change scene under my reset button?
  • ozboybrianozboybrian PRO Posts: 2,102
    Create a Rule in the Reset button.

    Rule.
    Actor Receives Event - Touch - Pressed.
    Behaviour - Reset SCENE (not game)
    ---------------------------------

    Then the Scene will start over.
  • triton13triton13 Member Posts: 161
    I tried that ozboy but it just resets my Game Over scene
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    The only attributes that would need resetting are any custom ones that you made. Do you have any custom attributes, like for keeping score or anything?

    You wouldn't HAVE to make a new scene for every level, but it would involve some serious attribute usage to tell it what level you are coming from, and keep track of it.

    Usually Game Over means if you want to play again, you are going to start from the beginning. I think what you are trying is a level fail?
  • ozboybrianozboybrian PRO Posts: 2,102
    Add me on Skype and I will help you.

    My Skype Username is the same as my GS username.
    How long have you been using GS for?
  • triton13triton13 Member Posts: 161
    Slick- I do have a custom attribute and I also need to figure out how to make myself a countdown timer, so those would have to be reset. Yeah, I guess it's not game over, it's a level fail if they do certain things wrong.

    ozboy- Alright, I'll add you and I have been using GS for about a week and a half. I'm a noob, I know lol
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Don't worry, you gotta start somewhere :)

    Basically in the button to start the scene over you would use change attributes and load attributes to get everything reset back to where it was when you originally started the level. If you are just starting out, you really should watch all the videos from the Cookbook, and other helper sites for GameSalad. The most important thing is to get an idea of the basic functions, and to really learn what attributes are what, and how they work. They are your best friend, and you will be using them a lot, so you really should get as familiar with them as you can early on.

    http://www.youtube.com/user/GameSaladCookbook
    http://gshelper.com/
    http://gleesongroupmedia.com/gsguide/gsguide.html
  • triton13triton13 Member Posts: 161
    Okay, I'm doing a little better with this, but I have one more question. How can I make it so when I click a button, it proceeds to the next scene but at the same time it resets all the attributes in the scene it's changing to?
  • KatAppsKatApps Member, PRO Posts: 84
    I'm wondering about the same thing (resetting score/attributes from scene to scene) ...
    But I can't quite figure it out either. Anyone know? You guys are great, thank you!
  • triton13triton13 Member Posts: 161
    Anyone please? Thank you =)
  • MotherHooseMotherHoose Member Posts: 2,456
    @triton13 … please read the cookbook and watch some of the getting-started videos … especially the ones @SlickZero gave you the links to …
    I have scads of experience with other gameMakingPlatforms and some with GS … and, I still watch every video I can … and did the Cookbook when it became available.

    gameAttributes are always active
    scene and actorInstance attributes only become active when the scene loads and runs

    therefore: a scene resets when the player leaves it (though if gameAttributes have changed … those changes can be applied when a scene loads)
    exception: Pause Game does not reset scene unless player can changeScene there

    @};- MH
  • triton13triton13 Member Posts: 161
    I've watched a bunch of videos but it still doesn't help. I kind of figured out what's going on. When my scene starts, the position of my actors are reset which is good. The huge problem though is my attributes won't reset even when I do have the reset scene behavior on. Do I need ot make another attribute that says to reset my other ones or what?
  • MotherHooseMotherHoose Member Posts: 2,456
    the scene doesn't do a reset it does a restart … it quits when you leave it; it restarts when you go back
    and all the attributes are as defined in the scene layout you did at first … not what has happened in while that scene has run

    But, changes to the gameAttributes that happened when that scene was running do not go back to their originals
    gameAttributes are always active at all times … when your game is running

    Sometime it is best to make sceneAttributes … if player can do a reset of the scene … EX: Score
    and on your changeScene button:
    Rule: when
    Event: touch is pressed
    --changeAttribute: game.Score To: game.Score+scene.Score
    --changeScene

    gameAttributes: store conditions for whole game
    sceneAttributes: store conditions only for that scene
    actorAttributes: store conditions only for that actor

    @};- MH
Sign In or Register to comment.