Advertisement
gravvy

Take Fall Damage

Jun 24th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. ////CREATE EVENT
  2. falling = 0;
  3. freefall = false;
  4. startfalling = false;
  5. fallcount = 0;
  6. damage_amt = 0;
  7. set_dmg = true;
  8.  
  9. hp = 100;
  10. max_hp = 100;
  11. hp_target = 100;
  12. current_hp =100;
  13.  
  14. ////STEP EVENT
  15. //Take Fall Damage
  16. fall = collision_line(x, y, x, room_height, obj_all_parent, false, true);
  17.  
  18. if(distance_to_object(fall) >= 128)
  19. {
  20. freefall = true;
  21. startfalling = true;
  22.  
  23. if(startfalling)
  24. {
  25. falling++;
  26. }
  27. }
  28. else
  29. {
  30.  
  31. if(startfalling)
  32. {
  33. fallcount = 14;
  34. }
  35.  
  36. startfalling = false;
  37. freefall = false;
  38. falling = falling;
  39.  
  40. if(fallcount >= 1)
  41. {
  42. fallcount--;
  43. }
  44.  
  45. if(fallcount <= 0)
  46. {
  47. fallcount = 0;
  48. }
  49.  
  50. if(!startfalling && fallcount == 0)
  51. {
  52. start_dmg = true;
  53.  
  54. if(start_dmg)
  55. {
  56. if(set_dmg)
  57. {
  58. damage_amt = falling;
  59. set_dmg = false;
  60. }
  61.  
  62. if(!set_dmg)
  63. {
  64. falling = 0;
  65. }
  66.  
  67. scr_minushp(damage_amt);
  68. start_dmg = false;
  69. }
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement