Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. /// @description Insert description here
  2. // You can write your code in this editor
  3. event_inherited();
  4. if ai_isghost
  5. {
  6.  
  7. }
  8. if (ai_active){
  9.  
  10. if (ai_tick<0)
  11. {
  12.  
  13. if (ai_action!=3) and (ai_action!=4) and (ai_action>-1)
  14. {
  15. if (abs(x-o_vernal.x)>48)
  16. {
  17. ai_action=choose(0,0,0,4)
  18.  
  19. }
  20. else
  21. {
  22.  
  23. ai_action=choose(1,1,2)
  24.  
  25.  
  26. }
  27. }
  28. hsp=0
  29.  
  30. }
  31.  
  32.  
  33.  
  34. switch (ai_action)
  35. {
  36. case 0: //go to
  37. if (ai_tick<0)
  38. {
  39. show_debug_message("walk")
  40. character_action_set(s_e_yknight_d_idle,0,0,60,60,true,true,false)
  41. if (x>o_vernal.x)
  42. {
  43. image_xscale=-1
  44. }
  45. else
  46. {
  47. image_xscale=1
  48. }
  49. ai_tick=80
  50. }
  51. var whichway=0
  52. if (x<o_vernal.x)
  53. {
  54. whichway=1
  55. }
  56. if (x>o_vernal.x)
  57. {
  58. whichway=-1
  59. }
  60. move_to(o_vernal.x+(16*whichway),0.025)
  61.  
  62.  
  63. break;
  64.  
  65. case 1: //attack
  66. if (ai_tick<0)
  67. {
  68. show_debug_message("swing")
  69.  
  70. character_action_set(s_e_yknight_maincombo,0,0,60,60,true,true,false)
  71. character_slash_set(s_player_ground01_fx,0,create_slash_p.none,false,100,100,1,1,0,false,1,"none","none","facing",false)
  72. if (x>o_vernal.x)
  73. {
  74. image_xscale=-1
  75. }
  76. else
  77. {
  78. image_xscale=1
  79. }
  80. ai_tick=60
  81. }
  82.  
  83.  
  84. break;
  85.  
  86. case 2: // jump one
  87. if (ai_tick<0)
  88. {
  89. show_debug_message("junp")
  90.  
  91. character_action_set(s_e_george_airidle,0,0,60,60,true,true,false)
  92. var whichway=0
  93. if (x<o_vernal.x)
  94. {
  95. whichway=-1
  96. }
  97. else
  98. {
  99. whichway=1
  100. }
  101.  
  102. ai_jump((whichway*2),-3)
  103.  
  104. if (x>o_vernal.x)
  105. {
  106. image_xscale=-1
  107. }
  108. else
  109. {
  110. image_xscale=1
  111. }
  112. ai_action=3
  113. ai_tick=15
  114. }
  115. break;
  116. //follow up actions
  117. case 3: // jump two
  118. if (ai_tick<0)
  119. {
  120. show_debug_message("junp")
  121.  
  122. character_action_set(s_e_george_airidle,0,0,60,60,true,true,false)
  123. var whichway=0
  124. if (x<o_vernal.x)
  125. {
  126. whichway=-1
  127. }
  128. else
  129. {
  130. whichway=1
  131. }
  132.  
  133. ai_jump((whichway*2),-4)
  134.  
  135. if (x>o_vernal.x)
  136. {
  137. image_xscale=-1
  138. }
  139. else
  140. {
  141. image_xscale=1
  142. }
  143. ai_action=4
  144. ai_tick=25
  145. }
  146.  
  147. break;
  148. case 4: // shoot
  149. if (ai_tick<0)
  150. {
  151.  
  152. show_debug_message("i shooot")
  153. character_action_set(s_player_air03,0,0,60,60,true,true,false)
  154. character_create_projectile(point_direction(x,y,o_vernal.x,o_vernal.y),1,0,0,200,5,5,"none",l_property.none,1,5)
  155. var whichway=0
  156.  
  157. if (x>o_vernal.x)
  158. {
  159. image_xscale=-1
  160. }
  161. else
  162. {
  163. image_xscale=1
  164. }
  165. ai_action=1
  166. ai_tick=100
  167. }
  168. break;
  169.  
  170.  
  171. //NOW ENTERING GHOST ZONE
  172.  
  173. case -1: // ghost shoot
  174. if (ai_tick<0)
  175. {
  176.  
  177. show_debug_message("i shooot")
  178. character_action_set(s_player_air03,0,0,60,60,true,true,false)
  179. image_xscale=o_vernal.image_xscale
  180. if image_xscale=1
  181. {
  182. var projdirection = 0
  183. }
  184. else
  185. var projdirection = 180
  186. character_create_projectile(projdirection,4,0,0,200,5,5,"none",l_property.none,1,5)
  187.  
  188.  
  189.  
  190. ai_action=-2
  191. ai_tick=40
  192. }
  193. break;
  194. case -2: // i die now
  195. if (ai_tick<0)
  196. {
  197. o_vernal.canghost=true
  198. instance_destroy(id,false)
  199. }
  200. break;
  201.  
  202.  
  203. }
  204.  
  205.  
  206.  
  207. ai_tick-=1*get_delta_time()
  208.  
  209. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement