Need help making the game pause when they lose to click retry/Make a retry button

I'm very new to GS and i desperately need help! when the player loses the game, I need the scene to pause and have button pop up that says {RETRY} and after they click {RETRY} the scene resets and the game starts up again.

And i need help making this {RETRY} button...Like what behavior or rule do i need to use/make?

Thank you so much in advance!!!

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Okay so this is pretty easy.

    Make your button and figure out where you want it to show up. It would he best to have it display on a nonscrollable layer if you have a scene larger than the nominal camera size. You can do it two ways you could either spawn the button and have it constrain to the defined X and Y position or you can leave it on the scene and turn the alpha to 0. Also if you are storing info in game level attributes you will need to also reset them to their default values as a scene reset doesn't do that for you. It just resets the scene to default.

    Spawining method on nonscrollable layer

    Place an actor on the scene, in the nonscrollable layer,off to the side and call it scene_manager.

    I side that actor put a rule that defines when game is to end. So let's just say to track player lives, can be any value.

    Rule

    When game.player.lives = 0

    Spawn actor BUTTON

    Set the X and Y of where you want the actor to appear. And relative to scene

    In the button have this code

    Rule

    (If you want to have the button already on the scene. Don't do the above code and add the code in bold to this actor and set it's alpha to zero)

    When touch is released
    ** When Self.graphics.alpha = 1**

    Change attribute. Game.lives to 3
    Do anyother changes of game attributes here.

    Timer after .3

    Reset scene

    **Rule
    When game.player.lives = 0

    Change attribute. Self.color.alpha to 1**

  • BellowBellow Bartender Member, PRO Posts: 227

    You need to put destroy actor to. If you are using spawn actor. when touch release destroy this actor

    and for alpha

    if touch released change attribute self.color to 0

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited November 2015

    @Bellow said:
    You need to put destroy actor to. If you are using spawn actor. when touch release destroy this actor

    and for alpha

    if touch released change attribute self.color to 0

    No you don't as the scene is being reset to default which means the spawned actor isn't there yet. Same with default alpha.

    This is what leads to bloated useless code.

  • BellowBellow Bartender Member, PRO Posts: 227

    ah thats true lol sorry

  • StormCloudGamesStormCloudGames Member, PRO Posts: 6

    Thank you so much guy's much!!!!!This helped so much!!

Sign In or Register to comment.