SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dir = sign(image_xscale)
  2. onground = (place_meeting(x,y+1,o_wall)) && sign(vsp) = 1  
  3. bump_wall = (place_meeting(x*dir + 10,y,o_wall))
  4. scr_collide()
  5.  
  6.  
  7. if damage_frames <0 damage_frames = 0;
  8.  
  9. switch (state)
  10. {
  11.     case enemy_state.idling:
  12.     hit = false
  13.     sprite_index = spr_enemy_idle
  14.     idling_wait++
  15.     if idling_wait >= 60
  16.     {
  17.         turn = turn * -1
  18.         turn_around = true
  19.         state = enemy_state.patrol
  20.     }; break;
  21.    
  22.     case enemy_state.patrol:
  23.     hit = false
  24.     hsp = 0
  25.     sprite_index = spr_enemy;
  26.     idling_wait = 0;
  27.    
  28.    
  29.         if bump_wall
  30.         {
  31.             if turn_around = false
  32.             {
  33.                 state = enemy_state.idling
  34.             }
  35.             turn_around = false
  36.         }
  37.         else hsp = turn * walksp
  38.         break;
  39.    
  40.     case enemy_state.damage:
  41.     sprite_index = spr_enemy_pain
  42.  
  43.     if hit = false
  44.     {
  45.         if !onground {hsp = 7 * -dir;}
  46.         vsp = -10
  47.         hit = true
  48.     }
  49.     damage_frames --;
  50.     if damage_frames <= 0 state = enemy_state.idling; break;
  51.    
  52.     case enemy_state.dead:
  53.        
  54.         instance_destroy(); break
  55.    
  56. }
  57.  
  58. if hit_points = 0 state = enemy_state.dead
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top