How do I get my character to respawn after dying?

0 favourites
  • 4 posts
From the Asset Store
Dodge or Die
$7.99 USD
You are stuck in a room...alone! Gotta survive this space scrape!
  • 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:

    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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Why not just make your player invisible ?

  • 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

  • It worked! It's now respawning. Thanks for the help Bonesey

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)