My game's respawn function will not work

I am trying to make a platformer, I got the camera to work, and I am trying to use the leave screen feature but every time I do more than one jump and then jump off the platform the game crashes, and when I try to reload it crashes the website, what are other solutions for respawning?

2 Likes

@hihilogic I know you got smooth respawns, may you see this person’s post? I’m not sure to show this person.

This is because the player will keep spawning something offscreen which crashes it since the camera is not at the spawn.

2 Likes

That makes sense how could that be fixed

1 Like

Before killing the player, set the camera coords to where they were originally.

1 Like

Ok I am going to try that

I just tried that and it didn’t work.

Ok, try making it enable a switch if the player is on screen, so it has to be on screen before it can be counted as off-screen.

I am not quite sure what you mean I tried a few different things and none of them were working.

Respawn is pretty simple to make, what do you want it to do?

I am trying to make a sidescroller game that tracks when the player falls off the screen and respawns them at the last flag they hit. This is the system I currently have but it is not working.

Have the respawn in the flag, not the player, it makes things easier. When the flag has a collision with the player add that position to a global. When the player dies send a message to the global to be the X and Y position of the new player

That is how I currently have it set up. The character can get the flag and respawn once but after that, it stops working. The camera goes to where the flag is but no character spawns.
Here is the link to the program: https://flowlab.io/game/view/1948920

Try having the character spawn, then the output from the spawn behavior goes into the destroyer

I figured out a solution Thank you @CodeAlpaca , @Galactian.

2 Likes