respawn actor

DookiDooki Member Posts: 247
edited November -1 in Working with GS (Mac)
how do i respawn an actor after it dies? Someone else asked something similar but reset scene. I don't want this. Thanks!

Comments

  • DookiDooki Member Posts: 247
    ...for more detail:

    - actor has three lives in game.
    - I have it set up that when he collides with enemy he gets destroyed.
    - I want him to respawn/reset to try again.
    - Oh, I just realized that once all three lives are done then what? I need to reset the scene ("Try again") after all the lives are up. I think I remember seeing this on the forum. Gotta search for this one!
  • DookiDooki Member Posts: 247
    OK:

    - I have a game.lives attribute set up for three lives.
    - I have a controller that when game.lives=0..........change scene (Currently to a nav page that has "try again" and "main menu." I know that I could also perhaps spawn a "try again" button/actor.

    - OK, so I don't know how to set up how to respawn an actor once it gets destroyed and you have two more lives left. FYI, my actor starts out in a specific location and is free moving. So, he could get killed across the screen but I need him to respawn back in the original location.
  • lowskilowski Member Posts: 25
    Not sure, but maybe you could use make a checkpoint and if your actor dies after crossing that checkpoint and has at least one life left he would respawn at the x and y of that checkpoint. You would have to have a save/load attribute set up on your player actor and the checkpoint actor but I'm not exactly sure how that works =/

    Hopefully this will give you some more ideas. Sorry I couldn't give a real solution....
  • DookiDooki Member Posts: 247
    Thanks lowski. Not sure what you mean by check point. What I can't figure out is, how do you respawn the actor after he has been destroyed?
  • DookiDooki Member Posts: 247
    Here is what I have set up so far:

    Rule: When collide with with tag Bullets"
    -Timer= 1sec
    --Spawn image (actor getting shot)
    --Play sound (impact sound)
    --Destroy
    --Change attribute: game.gamelives To: game.gamelives-1

    -Timer= 2sec
    --Spawn actor ( I've been playing the X,Y settings to get the actor to spawn in the original location.)

    Thoughts? Thanks!
  • DookiDooki Member Posts: 247
    OK, I kinda have it working. I created a respawn controller off to the side. The main actor does respawn but only the one time. If he dies again he does not respawn. Can anyone help on this?
    Here is what I have for the controller:

    Rule
    Attribute: game.playerlive=0
    -Spawn actor

    ---------------
    I created the attribute "playerlive" =1, and I added into my main actor's collision rule that when he gets hit (destroyed) it changes the attribute of playerlive to "0." Then with the controller in play the main actor is respawned. Hope someone out there can help??!
Sign In or Register to comment.