| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- function boss_showerhead_ai()
- {
- image_xscale = -boss_side;
-
- switch(state)
- {
- case "AWAIT":
- if global.player.x <= 3/4 * room_width
- {
- state = "SPAWN";
- animation_spd = 0.25;
- lock_player();
- lock_door();
- }
- case "SPAWN":
- if image_index == 10
- {
- for(var i = 0; i < 5; i++)
- icd(oShockwave, x, y, 0, {delay : i * 10});
- screen_shake(20);
- }
- else if animation_end()
- {
- unlock_player();
- state = "IDLE";
- idle_timer = 60;
- }
- break;
-
- case "WINDUP":
- if animation_end()
- {
- shoot_count = 0;
- state = "SHOOT";
- set_sprite(sBossShowerheadShoot);
- }
- break;
-
- case "SHOOT":
- if animation_end()
- {
- var _bomb = icl(oShowerheadBomb, x, y - 64);
- _bomb.x_spd = -boss_side * (4 - shoot_count * 1.5);
- _bomb.y_spd = -10;
-
- image_index = 0;
-
- if ++shoot_count >= 3
- {
- state = "IDLE";
- idle_timer = 60;
- set_sprite(sBossShowerheadIdle);
- }
- }
- break;
-
- case "SLAM":
- if animation_end()
- {
- var _sep = 240;
- var _start = irandom(_sep - 1);
-
- var _x = _start;
- while _x < room_width
- {
- icl(oShowerheadColumn, _x, room_height);
- _x += _sep;
- }
- screen_shake(10);
-
- state = "IDLE";
- idle_timer = 60;
- set_sprite(sBossShowerheadIdle);
- }
- break;
-
- case "IDLE":
- if --idle_timer <= 0
- {
- var _next = attack_queue[attack_index];
- attack_index = (attack_index + 1) % array_length(attack_queue);
-
- switch(_next)
- {
- case 1:
- state = "WINDUP";
- set_sprite(sBossShowerheadWindup);
- break;
- case 2:
- state = "SLAM";
- set_sprite(sBossShowerheadSlam);
- break;
- case 3:
- x_spd = boss_side * retreat_spd;
- state = "RETREAT";
- set_sprite(sBossShowerheadRetreat);
- break;
- }
- }
- break;
- case "RETREAT":
- var _target = (boss_side == 1) ? anchor_r + 128 : anchor_l - 128;
- if (boss_side == 1 && x >= _target) || (boss_side == -1 && x <= _target)
- {
- x = _target;
- x_spd = -boss_side * charge_spd;
- state = "CHARGE";
- set_sprite(sBossShowerheadCharge);
- }
- break;
- case "CHARGE":
- var _target = (boss_side == 1) ? anchor_l : anchor_r;
- if (boss_side == 1 && x <= _target) || (boss_side == -1 && x >= _target)
- {
- x = _target;
- x_spd = 0;
- boss_side *= -1;
- state = "IDLE";
- idle_timer = 60;
- set_sprite(sBossShowerheadIdle);
- }
- break;
- }
- }
|