Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @description Insert description here
  2. // You can write your code in this editor
  3.  
  4. var sonic = Player
  5. if place_meeting(x,y,obj_chaos_spear)
  6. {
  7.     action = 2
  8. }
  9. with(sonic)
  10. {
  11.     if action != act_death
  12.     {
  13.         if collision_onset(other.id) && action != act_hit
  14.         {
  15.             if homing_att == off
  16.             {
  17.                 if animation == ani_roll || animation == ani_homing || (global.player_id == "knuckles" && chaos_control == on)
  18.                 {
  19.                     other.action = 1
  20.                     if !ground && animation != ani_boost && boost == off
  21.                     {
  22.                         vsp = 0
  23.                         vsp-= 1.5
  24.                     }
  25.                     if ground
  26.                     {
  27.                         vsp = 10
  28.                     }
  29.                 }
  30.        
  31.                 if animation == ani_boost
  32.                 {
  33.                     other.action = 1
  34.                     if full_vspeed != 0
  35.                     {
  36.                         full_vspeed = 0
  37.                     }
  38.                 }
  39.            
  40.                 if animation == ani_spindash
  41.                 {
  42.                     other.action = 1
  43.                 }
  44.            
  45.                 if boost_ski == on
  46.                 {
  47.                     other.action = 1
  48.                 }
  49.            
  50.                 if animation != ani_homing && animation != ani_roll && animation != ani_boost && animation != ani_spindash && boost_ski == off
  51.                 {
  52.                     if invincibility == -1
  53.                     {
  54.                         if character != supersonic
  55.                         {
  56.                             if action != act_death
  57.                             {
  58.                                 player_hurt()
  59.                             }
  60.                         }
  61.                         else
  62.                         {
  63.                             other.action = 1
  64.                         }
  65.                     }
  66.                     else if invincibility < inv_action
  67.                     {
  68.                         if invincibility > 10000 && invincibility < 10800
  69.                         {
  70.                             other.action = 1
  71.                         }
  72.                         else
  73.                         {
  74.                             other.action = 0
  75.                         }
  76.                     }
  77.                     else
  78.                     {
  79.                         other.action = 0
  80.                     }
  81.                 }
  82.             }
  83.             if just_hom == on
  84.             {
  85.                 spring_lock = on
  86.                 just_hom = off
  87.             }
  88.         }  
  89.     }
  90.     else
  91.     {
  92.         exit;
  93.     }
  94. }
  95.        
  96.  
  97. if action == 1
  98. {
  99.     hp-= 1
  100.     if hp <= 0
  101.     {
  102.         with(id)
  103.         {
  104.             is_deactivated = true
  105.         }
  106.         instance_deactivate_object(id)
  107.        
  108.        
  109.         // This was destroy, but was changes so we can re-activate certain objects
  110.         // By the use of sensors
  111.         instance_create(x,y,obj_big_explostion)
  112.         if sonic.animation == sonic.ani_boost
  113.         {
  114.             sound_play(sfx_break_enemy)
  115.         }
  116.         else
  117.         {
  118.             sound_play(sfx_enemy_pop)
  119.         }
  120.     }
  121.     if sonic.homing_att == on sonic.homing_att = off
  122.     sonic.full_vspeed = 0
  123.     if global.player_id == "sonic" || global.player_id == "blaze"
  124.     {
  125.         sonic.boost_pwr += sonic.boost_gain
  126.     }
  127.     if global.player_id == "shadow"
  128.     {
  129.         sonic.chaos_pwr+= 10
  130.     }
  131.     action = 0
  132. }
  133.  
  134. if action == 2
  135. {
  136.    
  137.     instance_destroy(other)
  138.     hp-= 1
  139.     if hp <= 0
  140.     {
  141.         with(id)
  142.         {
  143.             is_deactivated = true
  144.         }
  145.         instance_destroy(self)
  146.        
  147.        
  148.         // This was destroy, but was changes so we can re-activate certain objects
  149.         // By the use of sensors
  150.         instance_create(x,y,obj_big_explostion)
  151.         var be = instance_nearest(x,y,obj_big_explostion)
  152.         with(be)
  153.         {
  154.             shadow = 1
  155.         }
  156.         sound_play(sfx_enemy_pop)
  157.        
  158.     }
  159. }
  160.    
  161. if global.pause == on
  162. {
  163.     image_speed = 0
  164. }
  165. else
  166. {
  167.     image_speed = 1
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement