External Exam Download Resources Web Applications Games Recycle Bin

platform | check points | gml

objPlayer Create

// player checkpoint variables:
checkpoint_x = x;
checkpoint_y = y;

objPlayer Step

// restart player at most recent checkpoint,
// depending on how player has died:
    
if (dead){
    x = checkpoint_x;
    y = checkpoint_y;
}

objCheckpoint Step

if place_meeting(x,y,objPlayer){
    objPlayer.checkpoint_x = x;
    objPlayer.checkpoint_y = y;
    instance_destroy(); // remove checkpoint flag
}
  
// ^ could also replace checkpoint flag sprite