Page 1 of 1

How do I get my character to respawn after dying?

PostPosted: Wed May 28, 2014 10:11 pm
by DorkWitAFork
This is my second day, so I am obviously very new. I was using one of the tutorials to set up a simple game. Now I'm trying to add a few things. Added a few explosions, sounds, and now I want my character to be able to respawn a few seconds after dying; I'd also like it to set the score back to zero, but I think I know how to do that much.
This is the event I tried to do:
Image
First, I did not add the action to make the system wait to go to the next action. I started with the simple respawn to see if he would appear immediately after being destroyed, which he did. But after I added the action to make the system wait before going to that respawn action, it no longer does anything. Well, all the monsters still move, but the character never reappears. I'm not entirely sure what I did wrong, so now I'm asking for a little assistance. Thanks in advance! :)

Re: How do I get my character to respawn after dying?

PostPosted: Thu May 29, 2014 12:03 am
by granpa
Why not just make your player invisible ?

Re: How do I get my character to respawn after dying?

PostPosted: Thu May 29, 2014 1:06 am
by Bonesey
So here is what is happening. Because you added the system wait, the player--> spawn object isn't going to work because the player is long gone (there is no player to create the object). So what we want to do is instead have:
Wait 4,5 secs
SYSTEM---> create object ->player

Now the problem with this is that we don't know where to create the player, so we will need to create some variables to make this work. So start by making 2 global variables named playerX and playerY. Now make this event

Player on destroyed--->System-> set var playerX to player.X
set var playerY to player.Y
Wait 4.5 secs
Create object "player" at (playerX, playerY)


Let me know if this works for you :)
Sorry I couldn't give a capx I'm on my phone lol

Cheers,
Bonesey

Re: How do I get my character to respawn after dying?

PostPosted: Sat May 31, 2014 4:06 pm
by DorkWitAFork
It worked! It's now respawning. Thanks for the help Bonesey :)