| 1 |
var battle_box = 3154; |
| 2 |
switch (attack_state) |
| 3 |
{ |
| 4 |
case 1: |
| 5 |
var x_target = battle_box.x; |
| 6 |
x = lerp(x, x_target, 0.3); |
| 7 |
if (abs(x - x_target) <= 1) |
| 8 |
{ |
| 9 |
x = x_target; |
| 10 |
attack_state += 1; |
| 11 |
} |
| 12 |
break; |
| 13 |
case 2: |
| 14 |
if (image_speed == 0) |
| 15 |
image_speed = 0.5; |
| 16 |
if (image_index >= (image_number - 1)) |
| 17 |
{ |
| 18 |
sword_color = choose("blue", "orange"); |
| 19 |
attack_state += 1; |
| 20 |
if (sword_color == "blue") |
| 21 |
{ |
| 22 |
sprite_index = spr_attack_moray_sword_blue_start; |
| 23 |
image_index = 0; |
| 24 |
image_speed = 1/3; |
| 25 |
} |
| 26 |
if (sword_color == "orange") |
| 27 |
{ |
| 28 |
sprite_index = spr_attack_moray_sword_orange_start; |
| 29 |
image_index = 0; |
| 30 |
image_speed = 1/3; |
| 31 |
} |
| 32 |
} |
| 33 |
break; |
| 34 |
case 3: |
| 35 |
if (image_index >= (image_number - 1)) |
| 36 |
{ |
| 37 |
if (sword_color == "blue") |
| 38 |
{ |
| 39 |
sprite_index = spr_attack_moray_sword_blue_spin; |
| 40 |
image_index = 0; |
| 41 |
image_speed = 0.25; |
| 42 |
} |
| 43 |
if (sword_color == "orange") |
| 44 |
{ |
| 45 |
sprite_index = spr_attack_moray_sword_orange_spin; |
| 46 |
image_index = 0; |
| 47 |
image_speed = 0.25; |
| 48 |
} |
| 49 |
attack_state += 1; |
| 50 |
no_loop = false; |
| 51 |
exit; |
| 52 |
} |
| 53 |
break; |
| 54 |
case 4: |
| 55 |
box_dist = abs(y - battle_box.y); |
| 56 |
if (y > battle_box.y) |
| 57 |
attack_state += 1; |
| 58 |
else |
| 59 |
attack_state += 2; |
| 60 |
break; |
| 61 |
case 5: |
| 62 |
if (path_position == 0) |
| 63 |
path_start(fly_path, 25, path_action_stop, true); |
| 64 |
else if (path_position >= 1) |
| 65 |
attack_state = 7; |
| 66 |
break; |
| 67 |
case 6: |
| 68 |
if (path_position == 1) |
| 69 |
path_start(fly_path, -25, path_action_stop, true); |
| 70 |
else if (path_position <= 0) |
| 71 |
attack_state = 7; |
| 72 |
break; |
| 73 |
case 7: |
| 74 |
if (image_index >= (image_number - 1)) |
| 75 |
{ |
| 76 |
if (irandom(pseudo_random_number) == 0) |
| 77 |
{ |
| 78 |
attack_state = 4; |
| 79 |
pseudo_random_number = pseudo_random_max; |
| 80 |
exit; |
| 81 |
} |
| 82 |
else |
| 83 |
{ |
| 84 |
pseudo_random_number = clamp(pseudo_random_number - 1, 0, pseudo_random_max); |
| 85 |
} |
| 86 |
if (sword_color == "blue") |
| 87 |
sword_color = "orange"; |
| 88 |
else |
| 89 |
sword_color = "blue"; |
| 90 |
if (sword_color == "blue") |
| 91 |
{ |
| 92 |
sprite_index = spr_attack_moray_sword_blue_start; |
| 93 |
image_index = 0; |
| 94 |
image_speed = 0.75; |
| 95 |
} |
| 96 |
if (sword_color == "orange") |
| 97 |
{ |
| 98 |
sprite_index = spr_attack_moray_sword_orange_start; |
| 99 |
image_index = 0; |
| 100 |
image_speed = 0.75; |
| 101 |
} |
| 102 |
attack_state = 4; |
| 103 |
} |
| 104 |
break; |
| 105 |
} |
| 106 |
if (path_speed >= 0.1 || path_speed <= -0.1) |
| 107 |
{ |
| 108 |
var remnant = instance_create(x, y, obj_attack_moray_sword_spin_remnant); |
| 109 |
remnant.sprite_index = sprite_index; |
| 110 |
remnant.image_speed = 0; |
| 111 |
remnant.image_index = 0; |
| 112 |
} |
| 113 |
if ((sprite_index == spr_attack_moray_sword_blue_start || (sprite_index == sprite_index) == 3501) && image_index >= (image_number - 1)) |
| 114 |
{ |
| 115 |
if (sword_color == "blue") |
| 116 |
{ |
| 117 |
sprite_index = spr_attack_moray_sword_blue_spin; |
| 118 |
image_index = 0; |
| 119 |
image_speed = 0.25; |
| 120 |
} |
| 121 |
if (sword_color == "orange") |
| 122 |
{ |
| 123 |
sprite_index = spr_attack_moray_sword_orange_spin; |
| 124 |
image_index = 0; |
| 125 |
image_speed = 0.25; |
| 126 |
} |
| 127 |
} |
| 128 |
if (sword_color == "blue") |
| 129 |
{ |
| 130 |
if (instance_exists(obj_attack_moray_sword_spin_orange)) |
| 131 |
instance_destroy(obj_attack_moray_sword_spin_orange); |
| 132 |
if (!instance_exists(obj_attack_moray_sword_spin_blue)) |
| 133 |
instance_create(x, y, obj_attack_moray_sword_spin_blue); |
| 134 |
} |
| 135 |
else if (sword_color == "orange") |
| 136 |
{ |
| 137 |
if (instance_exists(obj_attack_moray_sword_spin_blue)) |
| 138 |
instance_destroy(obj_attack_moray_sword_spin_blue); |
| 139 |
if (!instance_exists(obj_attack_moray_sword_spin_orange)) |
| 140 |
instance_create(x, y, obj_attack_moray_sword_spin_orange); |
| 141 |
} |