| 1 |
if (live_call()) |
| 2 |
return global.live_result; |
| 3 |
var soul = 2980; |
| 4 |
switch (state) |
| 5 |
{ |
| 6 |
case "idle": |
| 7 |
sprite_index = spr_bigfrog_knight_idle; |
| 8 |
image_speed = 1; |
| 9 |
state_timer -= 1; |
| 10 |
if (state_timer <= 0) |
| 11 |
{ |
| 12 |
state_switch("run"); |
| 13 |
if (soul.y >= bbox_top) |
| 14 |
{ |
| 15 |
if (irandom(3) == 1) |
| 16 |
state_switch("attack"); |
| 17 |
} |
| 18 |
} |
| 19 |
break; |
| 20 |
case "run": |
| 21 |
if (sprite_index != spr_bigfrog_knight_start_run && sprite_index != spr_bigfrog_knight_run) |
| 22 |
{ |
| 23 |
sprite_index = spr_bigfrog_knight_start_run; |
| 24 |
image_index = 0; |
| 25 |
image_speed = 1; |
| 26 |
run_switch_count = irandom_range(1, 2); |
| 27 |
} |
| 28 |
hsp = lerp(hsp, hsp_max, 0.25); |
| 29 |
var jump_chance = 5; |
| 30 |
if (run_switch_count <= 0 && abs(x - soul.x) < 60) |
| 31 |
{ |
| 32 |
state_switch("jump"); |
| 33 |
if (soul.y >= bbox_top) |
| 34 |
{ |
| 35 |
if (irandom(2) == 1) |
| 36 |
state_switch("attack"); |
| 37 |
} |
| 38 |
} |
| 39 |
break; |
| 40 |
case "jump": |
| 41 |
if (sprite_index != spr_bigfrog_knight_air_slash) |
| 42 |
{ |
| 43 |
sprite_index = spr_bigfrog_knight_air_slash; |
| 44 |
image_index = 0; |
| 45 |
image_speed = 1; |
| 46 |
} |
| 47 |
else if (image_index == 1 && floored == true) |
| 48 |
{ |
| 49 |
floored = false; |
| 50 |
vsp = -8; |
| 51 |
} |
| 52 |
else if (image_index >= (image_number - 1)) |
| 53 |
{ |
| 54 |
image_index = image_number - 1; |
| 55 |
image_speed = 0; |
| 56 |
if (floored == true) |
| 57 |
{ |
| 58 |
state_switch("idle"); |
| 59 |
if (soul.y >= bbox_top) |
| 60 |
{ |
| 61 |
if (irandom(5) == 1) |
| 62 |
state_switch("attack"); |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
if (hsp_max > 0) |
| 67 |
{ |
| 68 |
if (hsp > 0) |
| 69 |
hsp -= 0.3; |
| 70 |
else |
| 71 |
hsp = 0; |
| 72 |
} |
| 73 |
else if (hsp < 0) |
| 74 |
{ |
| 75 |
hsp += 0.3; |
| 76 |
} |
| 77 |
else |
| 78 |
{ |
| 79 |
hsp = 0; |
| 80 |
} |
| 81 |
break; |
| 82 |
case "attack": |
| 83 |
if (sprite_index != spr_bigfrog_knight_slash && sprite_index != spr_bigfrog_knight_slash_reset) |
| 84 |
{ |
| 85 |
sprite_index = spr_bigfrog_knight_slash; |
| 86 |
image_index = 0; |
| 87 |
image_speed = 1; |
| 88 |
hsp = 7; |
| 89 |
hsp_max = abs(hsp_max); |
| 90 |
if (soul.x < x) |
| 91 |
{ |
| 92 |
hsp = -7; |
| 93 |
hsp_max = -abs(hsp_max); |
| 94 |
} |
| 95 |
} |
| 96 |
else if (image_index >= (image_number - 1)) |
| 97 |
{ |
| 98 |
if (sprite_index != spr_bigfrog_knight_slash_reset) |
| 99 |
{ |
| 100 |
sprite_index = spr_bigfrog_knight_slash_reset; |
| 101 |
image_index = 0; |
| 102 |
image_speed = 1; |
| 103 |
} |
| 104 |
else |
| 105 |
{ |
| 106 |
state_switch("run"); |
| 107 |
} |
| 108 |
} |
| 109 |
if (hsp_max > 0) |
| 110 |
{ |
| 111 |
if (hsp > 0) |
| 112 |
hsp -= 0.15; |
| 113 |
else |
| 114 |
hsp = 0; |
| 115 |
} |
| 116 |
else if (hsp < 0) |
| 117 |
{ |
| 118 |
hsp += 0.15; |
| 119 |
} |
| 120 |
else |
| 121 |
{ |
| 122 |
hsp = 0; |
| 123 |
} |
| 124 |
break; |
| 125 |
case "cast": |
| 126 |
if (sprite_index != spr_bigfrog_knight_slash && sprite_index != spr_bigfrog_knight_slash_reset) |
| 127 |
{ |
| 128 |
sprite_index = spr_bigfrog_knight_slash; |
| 129 |
image_index = 0; |
| 130 |
image_speed = 1; |
| 131 |
can_cast = true; |
| 132 |
} |
| 133 |
else if (image_index >= 1 && can_cast) |
| 134 |
{ |
| 135 |
for (var i = 0; i < 3; i++) |
| 136 |
{ |
| 137 |
var bullet = instance_create_depth(x, y, depth + 1, obj_battle_enemy_attack_macro_knight_bullet); |
| 138 |
if (hsp_max > 0) |
| 139 |
bullet.direction = i * 30; |
| 140 |
else |
| 141 |
bullet.direction = 180 - (i * 30); |
| 142 |
bullet.speed = 11; |
| 143 |
} |
| 144 |
can_cast = false; |
| 145 |
} |
| 146 |
else if (image_index >= (image_number - 1)) |
| 147 |
{ |
| 148 |
if (sprite_index != spr_bigfrog_knight_slash_reset) |
| 149 |
{ |
| 150 |
sprite_index = spr_bigfrog_knight_slash_reset; |
| 151 |
image_index = 0; |
| 152 |
image_speed = 1; |
| 153 |
} |
| 154 |
else |
| 155 |
{ |
| 156 |
state_switch("run"); |
| 157 |
} |
| 158 |
} |
| 159 |
break; |
| 160 |
case "victory": |
| 161 |
hsp = 0; |
| 162 |
if (sprite_index != spr_bigfrog_knight_victory) |
| 163 |
{ |
| 164 |
sprite_index = spr_bigfrog_knight_victory; |
| 165 |
image_index = 0; |
| 166 |
image_speed = 1; |
| 167 |
} |
| 168 |
else if (image_index >= (image_number - 1)) |
| 169 |
{ |
| 170 |
instance_destroy(); |
| 171 |
instance_destroy(obj_battle_enemy_attack_macro_sword_frog_creator); |
| 172 |
exit; |
| 173 |
} |
| 174 |
break; |
| 175 |
} |
| 176 |
x += hsp; |
| 177 |
vsp += grav; |
| 178 |
if ((y + vsp) >= (battle_box.bbox_bottom - 4)) |
| 179 |
{ |
| 180 |
while ((y + sign(vsp)) < (battle_box.bbox_bottom - 4)) |
| 181 |
y += sign(vsp); |
| 182 |
vsp = 0; |
| 183 |
floored = true; |
| 184 |
} |
| 185 |
y += vsp; |
| 186 |
|
| 187 |
function state_switch(arg0) |
| 188 |
{ |
| 189 |
state = arg0; |
| 190 |
state_timer = 15; |
| 191 |
if (attack_timer <= 0) |
| 192 |
state = "victory"; |
| 193 |
} |
| 194 |
|
| 195 |
if ((x + (hsp * 3)) >= (battle_box.bbox_right - 4) || (x + (hsp * 3)) <= (battle_box.bbox_left + 4)) |
| 196 |
{ |
| 197 |
hsp = 0; |
| 198 |
hsp_max *= -1; |
| 199 |
run_switch_count -= 1; |
| 200 |
if (state == "run" && irandom(3) == 1) |
| 201 |
state_switch("cast"); |
| 202 |
} |
| 203 |
if (hsp_max > 0) |
| 204 |
image_xscale = -1; |
| 205 |
else if (hsp_max < 0) |
| 206 |
image_xscale = 1; |
| 207 |
attack_timer--; |