Spawning actors?

Hi, i just wanted to find out how exactly you code the re-spawning of an actor at a specific point on the scene (where it is at the beginning of the scene - its starting point). So basically after the main actor touches an enemy or a wall that destroys you i wanted the actor to spawn where it was at the beginning of the scene and for the actor to lose one life. Any help would be appreciated and the sooner the better as this is a school project due in a week, thanks.

Answers

  • carlblanchetcarlblanchet Member Posts: 755
    Don't destroy and spawn the character, simply use the behaviour change attribute and change its x and y position to the desired spot when overlaps or collides with the enemy and also do -1 to the life attribute.
  • sarah.schippkesarah.schippke Member Posts: 5
    I tried that but it still didn't work :/
  • sarah.schippkesarah.schippke Member Posts: 5
    This code works:

    Rule:
    Attribute: game.Total score < 0
    Change Attribute: self.position.X to 54
    Change Attribute: self.position.Y to 754
    Change Attribute: game.lives to game.lives-1
    Change Attribute: game.total score to 0


    However, this doesn't:


    Rule:
    When any conditions are valid:
    Actor receives event - overlaps or collides - actor with tag - enemies
    Actor receives event - overlaps or collides - actor with tag - death walls
    Change Attribute: self.position.X to 54
    Change Attribute: self.position.Y to 754
    Change Attribute: game.lives to game.lives-1

    all it does it subtract 1 life everytime i collide, but doesnt respawn/go back to set coordinates
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2012
    @sarah.schippke Please do not make create multiple discussions for the same issue. Doing so repeatedly will result in a forum ban.

    [closed]

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

This discussion has been closed.