Restart not working

dmariathasandmariathasan Member, PRO Posts: 3
edited May 2016 in Working with GS (Mac)

I want to make a game but my restart is not working the way that i want it to work, i want it to have two tries but it is not working. If you have any ideas please tell me

Comments

  • SocksSocks London, UK.Member Posts: 12,822
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2016

    Show your rules. Without them, we can't help you.

    Also, please use descriptive thread titles instead of just "HELP!" You can edit your post using the gear button, within 24 hours. [edited for you]

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

  • dmariathasandmariathasan Member, PRO Posts: 3

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2016

    Your loop conditions are when 0=0 and when 1≥0. Those are both always true. So that doesn't really do anything... it just allows the when touch is pressed rule to run. When you say you want "two tries" can you explain that a bit more?

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

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2016

    The conditions: When 0=0 / When 1 is larger than 0 are always true (0 always equals 0 and 1 is always larger than 0), so these conditions don't serve any purpose, you may as well drag the 'When touch is pressed' behaviour outside of this rule and delete it.

    EDIT - beaten to the same point by tatiang !

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Socks finally!

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

  • dmariathasandmariathasan Member, PRO Posts: 3

    No, the loop will only do attribute number or text

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @dmariathasan said:
    No, the loop will only do attribute number or text

    What does that mean? Can you post a screenshot of your rules?

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

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang said:
    @Socks finally!

    :smile:

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited May 2016

    Why are you using a loop anyway? You don't need a loop for that. And what do you mean two tries? Do you mean you want the player to have two tries at the game? Why aren't you using the reset game behavior? You would also need to reset any game level variables. That loop is not looking at any variables it is doing nothing and not needed.

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited May 2016

    As others have said you don't need a loop for this but I can see why you've misunderstood the loop behavior. You've put 2 in the max loops/frame box. This doesn't mean it will only run twice. What this means is the loop will run no more than 2 times per frame. If you're game is running at 60 frames per second your loop is running 120 times per second.

    You need to take your rule out from the loop and if you do need the rule to only work twice then you need to add a counter as a game or self attribute. Something like this

    game.restartCount = 0
    Rule: if touch is pressed is true and game.restartCount < 2
    ..Change Scene
    ..Change Attribute: game.restartCount = game.restartCount + 1

    I don't know why you would want to limit to only two restarts but that should do the job. You will need to set the restartCount to 0 at some point if you want the player to play the game again. Are these restarts lives? Do you really need to restart the game if they are lives? Is this why you want a count of 2?

    As @Lost_Oasis_Games mentioned you're not really restarting the game, you're just switching scene.

Sign In or Register to comment.