How Do I Get Lives to Reset When I Go Back To Scene?

Shadow_DevelopmentShadow_Development Rocklin, CA. United StatesMember Posts: 85

Hello GameSalad community, whenever the actor runs out of lives, it pauses the game and goes to a game over scene. When I press quit, it takes me back to start screen and after I press start again it takes me back to the level. In simpler forms: Actor Dies>Game Over scene appears>Press quit>Start scene appears>Press start>level scene appears. Once this is achieved the lives are supposed to go back to 5 but they are still at 0, and therefor telling the game to go back to the game over scene when the actor never really died... I know this may be very confusing but I've tried my very best to resolve this issue. I've literally spent days, now I've decided that it's time to ask for help. Yet sadly I have no idea what rules are causing this... Any help is appreciated.

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer

    Game attributes do not reset when you change or reset scenes. You have to manually reset them by doing change attribute game.lives to 5 right before the change scene or reset scene behavior.

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

Answers

  • willkeslingwillkesling Member, PRO Posts: 123

    One of the things you can do is create an off screen actor called rules. In your rules have a timer that runs after 0.5 that changes the attribute lives to 5.

    When you create a numeric attribute the game keeps a running total. This could be plus or minus the starting attribute number depending on what you set it to.

    A good way to monitor this when your testing the game is to create a text actor. Set the text actor to alpha zero, no movement and then have it display the attribute you want to monitor for testing/de-bugging.

Sign In or Register to comment.