Managing Retries

Hello heroes! Can you guys check my logic to make sure I'm headed in the right direction or not? I've just created a game, and at the end you have the option to play again. However, I would like to limit the number of times you can play again so people are spending all of their training time on this one game. Here's what I'm thinking. Please tell me if it's right:

- create a number variable

- create another trigger on the replay button that adds 1 to the variable

- create a condition on the trigger that says jump to slide x if variable is less than or equal to y 

10 Replies
Bobbi Bailey

To adjust variable back to zero, create an "adjust variable" trigger that executes when timeline starts.

One other thing that I think is important to point out (mentioned in the thread i posted above) is the order of your triggers.  If you notice in the the thread, the user was having an issue with the variables not changing, due to the order of the triggers.

Joanna Kurpiewska

It depends what type of variable you used.

1. If there's a true/false variable - set the trigger to:

adjust variable: (name of your variable) = value (your starting value - true or false) when timeline starts

2. if there's a true/false variable - set the trigger to:

adjust variable: (name of your variable) = value (your starting value - probably 0) when timeline starts


Give me a shout if you need any further help :)

Mike Enders

Hi Jessica,

It looks like the trigger on your try again layer is causing the problem. You currently have a condition on there to only play again if "replay" is less than three.  Keep in mind that triggers fire from top to bottom. So the reason that it's getting stuck is that the variable increments higher right before you ask it to jump.  So it's increasing from 2 to 3 and then the next trigger says to jump if the variable is less than 3 (which is no longer the case since the variable just incremented to 3 a nanosecond earlier).

The key is to remove that condition on the layer trigger.  The base layer triggers are already telling SL which layer to show so you don't need that condition on the layer level.

I hope this helps!