Advertisement
Guest User

Checkpoint Code

a guest
Jan 26th, 2015
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///rm_initialize
  2. //Creation Code
  3. global.checkpoint = noone;
  4. global.checkpointR = noone;
  5. global.checkpointx = noone;
  6. global.checkpointy = noone;
  7.  
  8. room_goto_next(); //Sends player to the next room which is the menu room
  9.  
  10. ///obj_checkpoint //I have several of these in the room I am working with
  11. //Create Event
  12. image_speed = 0;
  13. image_index = 0;
  14.  
  15. //Step Event
  16. if (place_meeting(x,y,obj_player))
  17. {
  18.     global.checkpoint = id; //Our current checkpoint is the id of this particular checkpoint
  19.     global.checkpointx = x;
  20.     global.checkpointy = y;
  21.     global.checkpointR = room;
  22. }
  23.  
  24. if (global.checkpointR == room)
  25. {
  26.     if (global.checkpoint == id) //If the checkpoint is this SPECIFIC checkpoint
  27.     {
  28.     image_speed = 0.5;
  29.     }
  30.     else
  31.     {
  32.     image_speed = 0;
  33.     image_index = 0;
  34.     }
  35. }
  36.  
  37. if (image_index > 4)
  38. {
  39.     image_index = 4;
  40.    
  41. }
  42.  
  43. //Room End
  44. instance_destroy();
  45.  
  46. ///obj_player
  47. //Step Event
  48. if (place_meeting(x,y,obj_respawn)) && (global.checkpointR != noone)
  49. {
  50.     room_goto(global.checkpointR);
  51.     x = global.checkpointx;
  52.     y = global.checkpointy;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement