my actor moves by itself when you retry the game, sometimes

Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

Hello, I have buttons to move an actor, and I have a retry button to restart the game scene, and when I retry the game, the actor moves by itself sometimes. Anyone know why this is happening? Thank you

Comments

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

    Using Reset Scene or Change Scene behaviors does not reset the value of any game attributes. You'll need to do this manually with one or more Change Attribute behaviors.

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

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    @tatiang said:
    Using Reset Scene or Change Scene behaviors does not reset the value of any game attributes. You'll need to do this manually with one or more Change Attribute behaviors.

    Hello, I didn't really understand what you said, could you explain it in a bit more detail please?

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

    Let's say you have an actor on your scene that changes game.MoveRight to true when you click on it. So you play the game and click that actor and game.MoveRight is true. Your other actor starts moving to the right. Then you click the Reset button that uses a Reset Scene behavior and your scene is reset. But your actor keeps moving right because game.MoveRight is still true.

    Instead of this:

    When Touch is Pressed
         Reset Scene

    You need this:

    When Touch is Pressed
         Change Attribute game.moveRight to false
         Reset Scene

    That's true for ALL game attributes that you want to reset. If you have game.lives or game.startedLevel or anything else that you don't want to keep its value, you need to change it back to the starting value right before you reset the scene. If you are using Change Scene instead of Reset Scene, it's still the same idea: change the attribute values before changing the scene.

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

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    Thank you, I'll try that.

Sign In or Register to comment.