Actor wont spawn before resetting scene
dwibre
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?
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
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
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.
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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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