Question about respawning

whycaliwhycali Member, PRO Posts: 87

So currently I have a hero with 3 lives and when he is hit by an enemy he is destroyed and looses a life and starts back at the beginning of the level and the enemy is still there. When the Hero jumps on the enemy he is destroyed and the hero continues on with the level. But if he dies such as falls down a hole or hit by another enemy and starts over all destroyed enemies do not come back. I am wondering how do i get the enemy to respawn to their same location that i originally placed them? I am using the same actor for all the enemy as they are the same character.

Comments

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

    Can you just reset the scene?

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

  • whycaliwhycali Member, PRO Posts: 87

    @tatiang if i reset the scene will it reset say the coins in the game if so that would be a reason not to reset as the coins mean something as well.

  • ArmellineArmelline Member, PRO Posts: 5,332

    Perhaps have each enemy note its starting location and condition in self attributes. When it's killed, move it off the scene. When you trigger whatever attribute you trigger to start the level, have it return to its original location by looking at the self attributes.

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

    The Reset Scene behavior resets actors' self attributes and scene attributes but not game-level attributes (e.g. game.score).

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

  • whycaliwhycali Member, PRO Posts: 87

    So here is my issue right now. when my Hero Actor kills the Enemy Actor i make it alpha = 0. which works great but my Hero still is destroyed as it hits the alpha 0 Enemy. I have in hero actor a collide or touch setup which is needed if the enemy hits my Hero. How can i make it so my Hero wont destroy once I make the enemy alpha 0. My other issue is i use the same Enemy Actor for multiple enemies and I don't know how to make the kill/destroy specific to each enemy actor as there are many of them.

    I know this probably sounds weird but its hard to articulate what is going on. So that being said Thank you all for help in this matter.

    WhyCali.

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

    It helps to show your rules rather than just describe them but I'll go by what you're saying and offer this:

    Move the enemy off-scene and move it back into place when needed. Or destroy the enemy and re-spawn it later when needed.

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

Sign In or Register to comment.