So I’m currently making a platformer game and currently the player spawns at a certain point. I want to have multiple spawnpoints, but I can’t seem to think a way to do that. Any ideas? Any help is appreciated.
If you want to let the player spawn at a random spawnpoint you could just use the conditon “pick a random object” > “Spawnpoint” and create the player at Spawnpoint.X() / . Y().
If you have multiple spawnpoints in the level and want to let the player respawn at the nearest one to the location of death you could do the following:
assign every Spawnpoint a unique id with a value from 1 to X)
Use a player variable to save the last spawnpoint.
When the player collides with a Spawnpoint that has an id greater than the last spawnpoint you collided with save that id in the playervariable instead.
On death you can spawn the player at the location of the last spawnpoint via filtering condition by checking the objects variable “spawnpoint id” and moving the player to its X/Y location.
This is how I tried to do it, but for some reason it spawns the player at third spawn (last one). What did I do wrong here?