How can I spawn an actor before changing a scene?
dennisboys
Member Posts: 1
I am run into a situation and could not figure out a way to solve.
I am making a shooting game. I want to realize that when the player's health is 0, it spawn an explosion actor, then the game changes to a Lose scene. However, the game change to Lose scene immediately when the player's health is 0 and the explosion actor is not quick enough to display.
How can I solve this? I just want the explosion actor displays before going to the lose scene.
Currently, my game logic is:
When player's health is 0:
1. then display explosion actor;
2. destroy the player actor;
3. change to the lose scene;
I am making a shooting game. I want to realize that when the player's health is 0, it spawn an explosion actor, then the game changes to a Lose scene. However, the game change to Lose scene immediately when the player's health is 0 and the explosion actor is not quick enough to display.
How can I solve this? I just want the explosion actor displays before going to the lose scene.
Currently, my game logic is:
When player's health is 0:
1. then display explosion actor;
2. destroy the player actor;
3. change to the lose scene;
Comments
Hi @dennisboys You've almost answered your own question.... "the explosion actor is not quick enough to display."
So you have to tell GSC to wait until the explosion actor has finished before the scene is changed. And to do this, you use the Time Behaviour.
So try this :
When player's health is 0:
1. then display explosion actor;
2. a Timer set to After how many secs you want the image to appear
3. destroy the player actor in Timer above;
3. change to the lose scene (also in Timer above);
Hope that helps.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I followed your instructions, but did not work the magic.
Now the logic is:
when player's health is 0:
1. Spawn the explosion actor;
2. Destroy the player actor;
3. Set Timer, after 2 seconds -> go to Lose scene;
However, the game never goes to Lose scene. Any idea why?
Add the timer to the explosion actor (if you are using this specific explosion only for the player death) and don't destroy it after.