Advertisement
MinusTree

Untitled

Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. if global.pause = 0 && global.stop = 0{
  2. if global.hurt = 0 image_alpha = 1;
  3.  
  4. //when hit
  5. if global.hurt = 1
  6. {
  7. global.hurt = 2;
  8. global.hp = global.hp - 1
  9. image_alpha=0.5;
  10. alarm[0] = 50; //invincibility frames
  11. }
  12.  
  13. //death
  14. if global.hp = 0
  15. {
  16. room_goto(rm_death);
  17. global.hp = global.maxhp;
  18. }
  19.  
  20. //movement and collision
  21. if (keyboard_check(ord("D")))
  22. {
  23. sprite_index = spr_player_right;
  24. if
  25. !place_meeting(x + 5, y, obj_wall) &&
  26. !place_meeting(x + 5, y, obj_guide) &&
  27. !place_meeting(x + 5, y, obj_gate) &&
  28. !place_meeting(x + 5, y, obj_cryguy) &&
  29. !place_meeting(x + 5, y, obj_bed)
  30. x = x + 4;
  31. }
  32.  
  33. if (keyboard_check(ord("A")))
  34. {
  35. sprite_index = spr_player_left;
  36. if
  37. !place_meeting(x - 5, y, obj_wall) &&
  38. !place_meeting(x - 5, y , obj_guide) &&
  39. !place_meeting(x - 5, y , obj_gate) &&
  40. !place_meeting(x - 5, y, obj_cryguy) &&
  41. !place_meeting(x - 5, y , obj_bed)
  42. x = x - 4;
  43. }
  44.  
  45. if (keyboard_check(ord("W")))
  46. {
  47. sprite_index = spr_player_back;
  48. if
  49. !place_meeting(x, y - 5, obj_wall) &&
  50. !place_meeting(x, y - 5, obj_guide) &&
  51. !place_meeting(x, y - 5, obj_gate) &&
  52. !place_meeting(x, y - 5, obj_cryguy) &&
  53. !place_meeting(x, y - 5, obj_bed)
  54. y = y - 4;
  55. }
  56.  
  57. if (keyboard_check(ord("S")))
  58. {
  59. sprite_index = spr_player;
  60. if
  61. !place_meeting(x, y + 5, obj_wall) &&
  62. !place_meeting(x, y + 5, obj_guide) &&
  63. !place_meeting(x, y + 5, obj_gate) &&
  64. !place_meeting(x, y + 5, obj_cryguy) &&
  65. !place_meeting(x, y + 5, obj_bed)
  66. y = y + 4;
  67. }
  68.  
  69. //shooting
  70. if ((keyboard_check(vk_right))
  71. or (keyboard_check(vk_left))
  72. or (keyboard_check(vk_down))
  73. or (keyboard_check(vk_up)))
  74. && (cooldown < 1)
  75. {
  76. instance_create_layer(x,y,"Bullets",obj_bullet)
  77. cooldown = 10;
  78. }
  79. cooldown = cooldown - 1;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement