How to reset scene with same score as before?

Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

Hello everyone, Thor speaking.

I wanted to know, when an actor collides with another actor, i want the scene to reset, but to keep the same score, because when that actor collides with the other actor you get one point. So i want the actor to be in the same place as before, so the scene restarts again with the score you had before.

Thankyou.

Thor.

Comments

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

    Game attributes do not change their value when using Reset Scene or Change Scene behaviors. So just make your score attribute a game attribute and you should be all set.

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

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    @tatiang said:
    Game attributes do not change their value when using Reset Scene or Change Scene behaviors. So just make your score attribute a game attribute and you should be all set.

    Ok thankyou, but then how would i reset the score back to 0, when i quit the game, or go to the home menu?

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

    Right before you Change Scene to those scenes, Change Attribute game.score to 0.

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

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    @tatiang said:
    Right before you Change Scene to those scenes, Change Attribute game.score to 0.

    Thankyou, that worked great :smile:

    I have another problem, i have an attribute- game.touches.count. So when the screen is pressed the actor moves, but i also have a pause button on the scene. So when i press the pause button the player also moves.

    So what would i need to do, to make that not happen?

    Thankyou.

    Thor.

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

    Here's a demo of how you might prevent that problem.

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

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    @tatiang said:
    Here's a demo of how you might prevent that problem.

    Thankyou tatiang, I will give that a try.

    Thanks.

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    Hi tatiang, I kind have a problem with something. I have an actor, a ball. that when collides with another actor,a post, you get one point and the scene resets. And I have another actor, a wall, that when collides with the ball actor I mentioned, the game ends, and the actor falls to the ground. But the problem is when the ball collides with the wall sometimes it touches the post as well. So the game doesn't end and you end up getting one point and the scene resets.

    So do you know how I would do it so when the ball collides with wall the ball will fall to the ground, and if it collides with the post as well it won't give me one point and it won't reset the scene.

    I hope that makes sense

    Thankyou

    Thor

  • Mayhem_MadnessMayhem_Madness Member, PRO Posts: 168

    Please let me know if that made sense.

  • tiger27tiger27 Member Posts: 127

    @Thor Create a text attribute titled WallHit and set it to no. Then, enter this coding in to the post when you get a point.

    If attribute WallHit is no
    If collision with post
    
    Change attribute (whatever attribute you're using for points) to (whatever attribute you're using for points)+1
    
    Destroy Ball
    
    Spawn actor Ball at position x,y
    

    Hope this helps! Message me back if you have any questions or if it works.

Sign In or Register to comment.