Actor wont spawn before resetting scene

dwibredwibre Member Posts: 192
My hero character has 3 lives before he dies and the scene is reset. When my hero character takes damage and loses one of his lives I spawn a 50% transparent red rectangle that covers the screen and fades after 0.5 seconds. This works effectively the first 2 times hero takes damage but on the 3rd life when the “death sequence” starts the transparent red rectangle will not spawn.

The death sequence goes something like.

Change attribute-game.life to -1
Change attribute –game.score to 0
Reset Scene.

The change attributes all work.

When I add the spawn actor before the change attributes it does not spawn just resets the scene.

I have tried adding a timer to the reset to give the spawn time to work but this just stops the reset from working.

Does anyone have any suggestions?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You'll need to post more of your rules. What is the rule condition for the death sequence? Which rules have anything to do with game.life? And I assume you mean change attribute game.life to game.life-1?

    Are you trying to spawn an actor and then reset the scene? If so, why? If you reset the scene, that spawned actor won't be present any longer.

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

  • dwibredwibre Member Posts: 192
    Ok so my life is indicated as a battery with 3 section.

    If hero collides with an object I have the following rule.

    INDICATE COLLIDE
    when actor receives event - Overlaps or collides with actor type - Hero
    Spawn Actor ( this is a red rectangle that fills the screen to indicate that hero has been hit)
    Change Attribute - game.Battery_life to Game.Battery_life-1

    My death trigger goes like this.

    when actor receives event - Overlaps or collides with actor type - Hero
    &
    Attribute game.Battery_Life = 0

    Change attribute - Game.Lives to Game.Lives-1
    Change Attribute - game.hero_Dead to true
    change attribute - game.Star_Points to
    Change Attribute - game.Battery_Life to 3
    Reset Scene

    I want to spawn the red rectangle when Hero looses his last bit of battery so it indicates the 3rd hit. Just resetting the game gives an awkward pause before reset and doesn't really indicate that you were hit or took damage.

    Hope this makes sense.



  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Okay, that all makes sense. So yes, you do need a timer. You said you added a timer and the scene didn't reset. I'm not sure why that would happen.

    Here's where you would add the timer:

    Change attribute - Game.Lives to Game.Lives-1
    Change Attribute - game.hero_Dead to true
    change attribute - game.Star_Points to
    Change Attribute - game.Battery_Life to 3
    Timer after 1 second [check run to completion]
    .....Reset Scene

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

  • dwibredwibre Member Posts: 192
    The red rectangle is only 50% Opacity and fades to alpha 0 in I second before being destroyed.
  • dwibredwibre Member Posts: 192
    Yeah its not working I think its because my Change attribute - game.hero_dead to true moves Hero back to the start position before reset.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    That's why you need to check "run to completion" so that when the collision rule is no longer true, it will still reset the scene. If that doesn't do the trick, maybe you can re-arrange the order of those change attribute behaviors or even place the game.hero_dead one inside of the timer.

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

  • dwibredwibre Member Posts: 192
    Thanks @tatiang but still no luck. Its as if it is forgetting to run the time even though run to completion is check. When I place game.hero_dead in the time as well nothing happens it just ignores the timer and hero stays where he is and the game does not reset. Tried moving the attributes but nothing. Any other Ideas?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited April 2013

    Hello @dwibre Something else to consider/try: If you are the Reset Scene behaviour to start the scene as fresh, and you haven't saved any attributes and have the load attribute behaviours at the beginning of the scene, then why not try a Change Scene Behaviour (choosing the actual scene you're in) instead of the Reset Scene...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • dwibredwibre Member Posts: 192
    Hey @gyroscope exactly the same thing happens it ignore the timer so "change scene" doesn't happen. If I take the timer out "change scene happens before the spawn.
  • dwibredwibre Member Posts: 192
    @FryingBaconStudios any idea why this is happening? (FBS has done some work on my game so know the in's and out's of the game)
Sign In or Register to comment.