• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker [HELP] Character returning to start position

yvodlyn

Member
Hi everyone!

NEED: I want to make a game where the player can return back at his start position. However, I don't know how to create this system.

EXPLANATION: When we click with the mouse button, the player will move to the nearest object or enemy (I KNOW HOW TO MAKE THE NEAREST SCRIPT). When the player hit the object or enemy, he will return to his start position. The start position of the player will be the same for the game.

Thank you!
 

Evanski

Raccoon Lord
Forum Staff
Moderator
Assuming the starting point of the player is where you first put it in the room use xstart and ystart
GML:
if (player hit){
    player.x = xstart;
    player.y = ystart;
}
 
Top