Advertisement
Guest User

Untitled

a guest
Nov 1st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///objSolid begin_step
  2. if (other.crushPlayer) {
  3.     show_debug_message("crushed at right");
  4.     if (!global.debugInvincibility)
  5.         global._health = 0;
  6. }
  7. else {
  8.     if (floor(y) < floor(bbox_get_ycenter(other)))
  9.         shunt_up(id, other.id, true, false);
  10.     else
  11.         shunt_down(id, other.id, true, false);
  12. }
  13.  
  14. ///shunt_down(id, [_solid = other], [is_first = true], [is_left = true])
  15. var ins = id;
  16. var _solid = other;
  17. if (argument_count > 2)
  18.     _solid = argument[2];
  19. var is_first = true;
  20. if (argument_count > 3)
  21.     is_first = argument[3];
  22. var is_left = true;
  23. if (argument_count > 4)
  24.     is_left = argument[4];
  25.  
  26. with(_solid) {
  27.     var shunt_block_check = collision_rectangle(floor(ins.bbox_left), ceil(bbox_bottom) + 32, ceil(ins.bbox_right), ceil(bbox_bottom) + 1, objSolid, false, true);
  28. }
  29. if (!shunt_block_check) {
  30.     ins.y = ceil(_solid.bbox_bottom) + (floor(bbox_get_height(ins) / 2) + 1);
  31.     hit_player(_solid.contactDamage);
  32.     if (is_left)
  33.         show_debug_message("Shunted down from left.");
  34.     else
  35.         show_debug_message("Shunted down from right.");
  36. }
  37. else {
  38.     if (is_first) {
  39.         shunt_up(ins, _solid, false, is_left);
  40.     }
  41.     else {
  42.         if (is_left)
  43.             show_debug_message("Failed to shunt from left. Crushing now.");
  44.         else
  45.             show_debug_message("Failed to shunt from right. Crushing now.");
  46.         if (!global.debugInvincibility)
  47.             global._health = 0;
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement