sErisHead 0 -1 0 0 <undefined> <undefined> 1 603 7 0 0 -1 2 self 0 0 1 canbeX = 1; // hp = 100; hp = global.mod_serrisHealth; // Check for ice in random games if (global.item[11] == 0) { hp = hp * 1.5; } maxhp = hp; // damage = 50; damage = global.mod_serrisDamage; speed = 0; // regular move at 4 boosting = 0; jawoff = 2; fxtimer = 0; flashing = 0; bodylength = 14; // 15 segments, plus head makes 16 roaring = 0; inrange = 0; facing = -1; direction = 180; turnspeed = 3; stun = 0; cooldown = 0; phase = 0; boostphase = 0; boostlaunch = 0; lock = 0; state = 10; statetime = 0; nextstate = 0; startx = x; // Targeting routine init tgt = 0; /*for (var p = 0; p < 8; p ++) { tgt1x[p] = 0; tgt1y[p] = 0; tgt2x[p] = 0; tgt2y[p] = 0; tgt3x[p] = 0; tgt3y[p] = 0; tgt4x[p] = 0; tgt4y[p] = 0; }*/ for (var i = bodylength; i >= 0; i --) { // Create body segment[i] = instance_create(x, y, oErisSegment); segment[i].x = x + (i*26); // DEBUG THIS LATER segment[i].order = i; segment[i].image_angle = image_angle; segment[i].direction = direction; segment[i].depth = -50 - i; if (i > 12) { segment[i].spr_normal = sErisNeck; segment[i].spr_frozen = sErisNeckF; segment[i].spr_open = sErisNeckD; } else if ((i < 4) && (i > 0)) { segment[i].spr_normal = sErisBody2; segment[i].spr_frozen = sErisBody2F; segment[i].spr_open = sErisBody2D; } else if (i == 0) { segment[i].sprite_index = sErisBody3; segment[i].tail = 1; } } alarm[0] = 1; // Bubbles! alarm[1] = 120; // Move SFX 1 603 7 0 0 -1 2 self 0 0 1 /// Pickups if(oControl.mod_fusion == 0) monster_spawn_powerups(x, y, random(4), random(3)); 1 603 7 0 0 -1 2 self 0 0 1 /// Move SFX var sfx = choose(0, 1, 2); if (inrange) { switch (sfx) { case 0: sfx_play(sndErisMove1); break; case 2: sfx_play(sndErisMove2); break; case 3: sfx_play(sndErisMove3); break; } } alarm[1] = 60 + random(90); 1 603 7 0 0 -1 2 self 0 0 1 /// BUBBLES if ((state != 100) && (inrange)) { var bubble = instance_create(x, y - 8, oLBubble); if (instance_exists(bubble)) { bubble.alarm[0] = 60; bubble.direction = image_angle; bubble.speed = speed * 0.6; bubble.depth = -90; } } alarm[0] = 4 + irandom(4); 1 603 7 0 0 -1 2 self 0 0 1 /// ANIMATION if (boosting > 0) { if (!audio_is_playing(sndSBEris)) { sfx_loop(sndSBEris); } } else if (!boosting) { sfx_stop(sndSBEris); } // FX Timer if (fxtimer >= 0) fxtimer -= 1; if (fxtimer == -1) fxtimer = 5; // Roaring if (roaring > 0) { if (jawoff < 8) jawoff += 2; } else if (jawoff > 2) jawoff -= 1; if (roaring > 0) roaring -= 1; // Flashing if (flashing > 0) flashing -= 1; /// MOVEMENT // Move first neck segment if (state != 100) { segment[14].x = lerp(segment[14].x, x + lengthdir_x(8, image_angle-180), 0.5); segment[14].y = lerp(segment[14].y, y + lengthdir_y(8, image_angle-180), 0.5); } /// STATE MACHINE inrange = ((x > 32) && (x < 608) && (y > 48) && (y < 448)); // fix later 1.5.1 if (state == 10) { // Spawn state if (statetime == 0) { x = 720; startx = 720; direction = 180; image_yscale = -1; event_user(0); } else if (statetime == 120) { sfx_play(sndErisRoar1); } else if (statetime == 180) { speed = 4; state = 2; // Start in movement state 2 nextstate = 2; statetime = 0; // Reset statetime mus_play(musEris); // Begin music oMusicV2.bossbgm = musEris; // Also begin music??? scan_log(37, get_text("ScanEvents", "ScanBioform"), 120, 0); // Start log } } if (state == 0) { lock = 0; if (boosting > 0) { boosting --; } nextstate += 1; if (nextstate > 3) { nextstate = 1; } if (statetime == 0) { if (boosting && (nextstate == 3)) { if (point_distance(320, 256, oCharacter.x, oCharacter.y) > 128) { nextstate = 1; } } switch (nextstate) { case 1: sfx_play(sndErisRoar1); break; case 2: sfx_play(sndErisRoar2); break; case 3: sfx_play(sndErisRoar3); break; //case 4: sfx_play(sndErisRoar4); break; } facing = -facing; if (floor(facing) == 1) { x = -16; startx = -16; direction = 0; image_yscale = 1; event_user(0); event_user(3); } else { x = 640; startx = 640; direction = 180; image_yscale = -1; event_user(0); event_user(3); } } // move to state if (statetime == (90 - (sign(boosting)*90))) { if (!boosting) { speed = 4 + (phase); // Boosts based on damage phase } else { speed = 9; // Boosting base speed } state = nextstate; statetime = 0; } } if (state == 1) { if ((!boosting) || lock) { // normal if (statetime == 0) { tgt = 0; turnspeed = 5 + (phase*2); y = 416; event_user(3); } // Targeting routine if ((point_distance(x, y, (tgt1x[tgt]*(-facing))+(640*((1+facing)/2)), tgt1y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt1x)-1)) { tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } if ((tgt == 4) || (tgt == 5) || (tgt == 6) || (tgt == 7) || (tgt == 8) || (tgt == 9) || (tgt == 10) || (tgt == 11) || (tgt == 12)) {//4 || 5 || 6 || 8 || 9 || 10 || 11)) { // Turnspeed for loops if (statetime < 300) { turnspeed = 6 + (phase*2) + (4*sign(boosting)); } if ((boosting > 0) && (statetime > 300)) { // Hope this works turnspeed += 0.1; } } else { turnspeed = 5 + (phase*2); } turn_towards_direction(point_direction(x, y, (tgt1x[tgt]*(-facing))+(640*((1+facing)/2)), tgt1y[tgt]), turnspeed); } else { // speedboosting if (statetime == 0) { tgt = 0; turnspeed = 15; y = 144; event_user(3); } // Targeting routine if ((point_distance(x, y, (tgt4x[tgt]*(-facing))+(640*((1+facing)/2)), tgt4y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt4x)-1)) { tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } turn_towards_direction(point_direction(x, y, (tgt4x[tgt]*(-facing))+(640*((1+facing)/2)), tgt4y[tgt]), turnspeed); } } if (state == 2) { if ((!boosting) || lock) { if (statetime == 0) { tgt = 0; turnspeed = 3 + (phase*2); y = 144; event_user(3); } // Targeting routine if ((point_distance(x, y, (tgt2x[tgt]*(-facing))+(640*((1+facing)/2)), tgt2y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt2x)-1)) { tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } turn_towards_direction(point_direction(x, y, (tgt2x[tgt]*(-facing))+(640*((1+facing)/2)), tgt2y[tgt]), turnspeed); } else { // Boosting if (statetime == 0) { tgt = 0; turnspeed = 15; y = 416; event_user(3); } if ((point_distance(x, y, (tgt5x[tgt]*(-facing))+(640*((1+facing)/2)), tgt5y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt5x)-1)) { tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } turn_towards_direction(point_direction(x, y, (tgt5x[tgt]*(-facing))+(640*((1+facing)/2)), tgt5y[tgt]), turnspeed); } } if (state == 3) { if ((!boosting) || lock) { if (statetime == 0) { tgt = 0; turnspeed = 4 + (phase*2); y = 288; event_user(3); } // Targeting routine if ((point_distance(x, y, (tgt3x[tgt]*(-facing))+(640*((1+facing)/2)), tgt3y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt3x)-1)) { tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } turn_towards_direction(point_direction(x, y, (tgt3x[tgt]*(-facing))+(640*((1+facing)/2)), tgt3y[tgt]), turnspeed); } else { // Boosting if (statetime == 0) { tgt = 0; turnspeed = 5; y = 288; event_user(3); } // Targeting routine if ((point_distance(x, y, (tgt6x[tgt]*(-facing))+(640*((1+facing)/2)), tgt6y[tgt]) < 32) && (speed != 0)) { if (tgt < (array_length_1d(tgt6x)-1)) { if ((tgt == 2) || (tgt == 8) || (tgt == 14)) { event_user(4); } tgt += 1; } else { speed = 0; state = 0; statetime = -1; } } turn_towards_direction(point_direction(x, y, (tgt6x[tgt]*(-facing))+(640*((1+facing)/2)), tgt6y[tgt]), turnspeed); } } if (boostlaunch > 0) { // Pre-boost if (flashing <= 1) { flashing = 10; } speed *= 0.95; boostlaunch --; if (boostlaunch <= 0) { lock = 1; speed = 9; turnspeed = 15; switch (boostphase) { case 1: boosting = 4; break; case 3: boosting = 5; break; case 5: boosting = 6; break; } boostphase ++; } } if (state == 100) { if (statetime < 30) { speed *= 0.8; } else if (vspeed > -0.2) { vspeed -= 0.01; } if (statetime == 0) { for (i = 0; i <= bodylength; i += 1) { with (segment[i]) { event_user(10); } } sfx_play(sndErisDeath); if(oControl.mod_fusion == 0) { mus_fadeout(musEris); oMusicV2.bossbgm = sndJump; } } if (statetime == 280) { repeat (8) { var expl = instance_create(x + random_range(-16, 16), y + random_range(-16, 16), oFXAnimSpark); expl.image_speed = 0.3 + random(0.5); expl.additive = 0; expl.sprite_index = sExpl1; } make_explosion3(x, y); repeat (20) { var bubble = instance_create(x, y, oLBubble); if (instance_exists(bubble)) { bubble.hspeed = random_range(-2.5, 2.5); bubble.vspeed = -random(0.4); } } instance_create(x, y, oScreenFlash); sfx_play(sndMissileExpl); global.event[261] = 1; if(oControl.mod_fusion == 0) { with (oDoorA5) { event_user(3); } mus_current_fadein(); } else { var core = instance_create(mean(bbox_left, bbox_right), mean(bbox_top, bbox_bottom), oCoreX); core.lastBossX = x; core.lastBossY = y; core.lastBossSprite = sprite_index; core.lastBossFrame = image_index; core.lastBossAngle = image_angle; core.lastBossFacing = 1; core.lastYscale = image_yscale; core.lastBossDepth = depth; } instance_destroy(); } } if ((state != 100) && (state != 0)) { image_angle = direction; } statetime ++; if (cooldown > 0) { cooldown --; } 1 603 7 0 0 -1 2 self 0 0 1 if (other.active) { if (floor(boosting) > 1) { boosting --; } if (hp >= 3) { hp -= 2; stun = 10; event_user(2); } sfx_play(sndErisRoar4); sfx_play(sndElectricExpl); } with (other) { active = 0; cooldown = cooldownmax; time = 0; } 1 603 7 0 0 -1 2 self 0 0 1 /// Damage Sarah if (state != 100) damage_player(damage, 7, -3, 0, 0); 1 603 7 0 0 -1 2 self 0 0 1 /// If not dead, destroy block if (state != 100) with (other) event_user(0); 1 603 7 0 0 -1 2 self 0 0 1 /// Fire projectiles roaring = 15; sfx_play(sndErisRoar4); var proj = instance_create(x, y, oErisProjectile); proj.direction = point_direction(x, y, oCharacter.x, oCharacter.y-(oCharacter.sprite_height/2)); /* if (!boosting) { if (boostphase < 3) { var proj = instance_create(x, y, oErisProjectile); proj.direction = point_direction(x, y, oCharacter.x, oCharacter.y-(oCharacter.sprite_height/2)); } else if (boostphase < 5) { var proj = instance_create(x, y, oErisProjectile); // FIXED YAY proj.direction = point_direction(x, y, oCharacter.x, oCharacter.y-(oCharacter.sprite_height/2)); proj.direction += (3); var proj2 = instance_create(x, y, oErisProjectile); // FIXED YAY proj2.direction = point_direction(x, y, oCharacter.x, oCharacter.y-(oCharacter.sprite_height/2)); proj2.direction -= (3); } else { for (i = -1; i < 2; i ++) { var proj = instance_create(x, y, oErisProjectile); // FIXED YAY proj.direction = point_direction(x, y, oCharacter.x, oCharacter.y-(oCharacter.sprite_height/2)); proj.direction += (i*15); } } } 1 603 7 0 0 -1 2 self 0 0 1 /// Realign body for (var i = bodylength; i >= 0; i --) { segment[i].x = x + (abs(i-13)*26*-facing); segment[i].y = y; } 1 603 7 0 0 -1 2 self 0 0 1 /// Take damage? flashing = 10; roaring = 30; sfx_play(sndErisHit); if ((hp < (maxhp)) && (hp >= ((3*maxhp)/4))) { phase = 0; } if ((hp < ((3*maxhp)/4)) && (hp >= (maxhp/2))) { phase = 1; if (boostphase == 0) { boostlaunch = 30; boostphase ++; } } if ((hp < (maxhp/2)) && (hp >= (maxhp/4))) { phase = 2; if (boostphase == 2) { boostlaunch = 30; boostphase ++; } } if (hp < (maxhp/4)) { phase = 3; if (boostphase == 4) { boostlaunch = 30; boostphase ++; } } if (hp <= 0) { state = 100; statetime = 0; } for (i = 0; i <= bodylength; i += 1) { segment[i].flashing = 10; } 1 603 7 0 0 -1 2 self 0 0 1 /// Maintain yscale for (i = 0; i < bodylength + 1; i += 1) { segment[i].image_yscale = image_yscale; } 1 603 7 0 0 -1 2 self 0 0 1 var jawdir = direction + 270 + (image_yscale == -1) * 180; draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, -1, 1); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, -1, 1); // Flashing if (flashing > 0) { draw_set_blend_mode(bm_add); repeat (2) { draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, -1, flashing * 0.1); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, -1, flashing * 0.1); } draw_set_blend_mode(bm_normal); } if (boosting) { draw_set_blend_mode(bm_add); if (fxtimer == 0 || fxtimer == 1) { draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, c_green, 1.1 + fxtimer * 0.2); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, c_green, 1.1 + fxtimer * 0.2); } if (fxtimer == 2 || fxtimer == 3) { repeat (2) { draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, c_yellow, 1); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, c_yellow, 1); draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, c_white, 1); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, c_white, 1); } } if (fxtimer == 4 || fxtimer == 5) { repeat (2) { draw_sprite_ext(sErisJaw, -1, x + lengthdir_x(jawoff, jawdir), y + lengthdir_y(jawoff, jawdir), 1, image_yscale, image_angle, c_red, 1); draw_sprite_ext(sErisHead, -1, x, y, 1, image_yscale, image_angle, c_red, 1); } } draw_set_blend_mode(bm_normal); } //debug //draw_text(16, 16, string(speed)); 0 0 0 0.5 0.100000001490116 0 0.100000001490116 0.100000001490116 0.200000002980232 -1 0