sSeptogg 0 -1 90 0 <undefined> <undefined> 1 603 7 0 0 -1 2 self 0 0 1 /// Initialize. // Modifiable variables. target_pop = y - 48; // The height that the Septogg pops out of the ground. orbit_amplitude = 28; // The distance they will fly around their parent Septogg. // Exit flight varibles. exit_speed_start = -2; // The speed that the Septogg will fly back with fright when reacting to Sarah. exit_speed = 1.5; // The general speed that it will fly to exit the room. exit_acceleration = 0.05; // The acceleration to it use to reach the top speed. exit_amplitude_x = random_range(0.625, 1.125); // Provide erratic movement. exit_amplitude_y = random_range(0.625, 1.125); exit_amplitude_lerp = 0.05; exit_frequency_x = random_range(0.02, 0.045); exit_frequency_y = random_range(0.02, 0.045); turnspeed = 2; // The rate at with the Spetogg will turn at to avoid Sarah. // Internal variables. xx = 0; yy = 0; depth = -80; image_speed = 0; image_index = 3; frequency_x = 0; amplitude_x = 0; timer_x = irandom(100); frequency_y = 0; amplitude_y = 0; timer_y = irandom(100); parent = -1; scavenge = -1; flyoff = 0; ytarget = 0; state = 0; statetime = 0; eye_glow = false; orbit = choose(-1, 1); rock_piece_sprite = -1; if(room == rm_a0h01 && global.timeofday == 2) orbit_amplitude*=1.25; 1 603 7 0 0 -1 2 self 0 0 1 /// Set Septogg sprite based on ground type. var sprite = baby_septogg_sprite(scavenge.x, scavenge.y); image_index = choose(1, 2, 3); image_speed = 0.33; if(sprite != -1) sprite_index = sprite; else instance_destroy(); 1 603 7 0 0 -1 2 self 0 0 1 /// Septogg Movement timer_x++; if(timer_x > 2 * pi/frequency_x) timer_x -= 2 * pi/frequency_x; timer_y++; if(timer_y > 2 * pi/frequency_y) timer_y -= 2 * pi/frequency_y; xx = sin(timer_x*frequency_x)*amplitude_x; yy = sin(timer_y*frequency_y)*amplitude_y; if(parent != -1) { eye_glow = true; amplitude_y = lerp(amplitude_y, orbit_amplitude / (1 + (1 * parent.grounded)), 0.01); ytarget = lerp(ytarget, parent.y - (55 * parent.grounded), 0.01); x = parent.xstart + xx; y = ystart + yy - ((parent.ystart) - ytarget) + 7; if((x-xprevious) > 0) depth = parent.depth-orbit; else depth = parent.depth+orbit; } else if(scavenge != -1) { eye_glow = true; if ((point_distance(x, y, oCharacter.x, oCharacter.y-24) < 64 && (oCharacter.state != oCharacter.STANDING)) || (instance_exists(oBeam) && point_distance(x, y, oBeam.x, oBeam.y) < 64) || (instance_exists(oMissile) && point_distance(x, y, oMissile.x, oMissile.y) < 64) || (instance_exists(oPBombExpl) && collision_circle(x, y, 16, oPBombExpl, 1, false))) { if(flyoff = 0) { flyoff = 1; depth = -150; direction = point_direction(x, y, oCharacter.x, oCharacter.y-24) + irandom_range(-80, 80); speed = exit_speed_start; xx = 0; yy = 0; amplitude_x = 0; amplitude_y = 0; frequency_x = exit_frequency_x; frequency_y = exit_frequency_y; play_septogg_sound(); } } if(!flyoff) { x = xstart + xx; y = ystart + yy; } } else { // Random encounter. if (state == 0) { if (y+24>oCharacter.y && point_distance(x, y, oCharacter.x, oCharacter.y) < 56) { state = 1; statetime = 0; } } if (state == 1) { if (statetime == 0) { play_septogg_sound(); image_speed = 0.33; direction = irandom(359); frequency_x = exit_frequency_x; frequency_y = exit_frequency_y; var particle = septogg_particle_sprite(); if(particle != -1) { repeat (8) { rock = instance_create(x, y - 8, oFXTrail); rock.sprite_index = particle; rock.image_index = floor(random(5)); rock.image_alpha = 1; rock.fadespeed = 0.005; rock.additive = 0; rock.vspeed = -1.5 - random(3.75); rock.hspeed = -1.5 + random(3); if(particle != sBubblesPiece1 and particle != sBubblesPiece2) rock.gravity = 0.2; else { rock.vspeed/=2; rock.hspeed/=2; } rock.gravity_direction = 270; rock.depth = -155; rock.image_xscale = 0.5; rock.image_yscale = 0.5; } } } if(statetime == 4) { depth = -155; eye_glow = true; } if (round(y) != target_pop && flyoff = 0) y = lerp(y, target_pop, 0.125); else flyoff = 1; } statetime += 1; } if(flyoff) { speed += exit_acceleration; if(speed > exit_speed) speed = exit_speed; amplitude_x = lerp(amplitude_x, exit_amplitude_x, exit_amplitude_lerp); amplitude_y = lerp(amplitude_y, exit_amplitude_y, exit_amplitude_lerp); if(speed > 0) { if(point_distance(x, y, oCharacter.x, oCharacter.y-24) < 160) { var playerdirection = point_direction(oCharacter.x, oCharacter.y-24, x, y); turn_towards_direction(playerdirection, turnspeed); } } x += xx; y += yy; } 1 603 7 0 0 -1 2 self 0 0 1 /// Set orbit variables. frequency_x = choose(-1, 1) * random_range(0.015, 0.035); amplitude_x = orbit_amplitude; frequency_y = choose(-1, 1) * random_range(0.015, 0.035); amplitude_y = orbit_amplitude; ytarget = parent.ystart; 1 603 7 0 0 -1 2 self 0 0 1 /// Set Septogg sprite based on parent. image_index = choose(1, 2, 3); image_speed = 0.33; switch (parent.sprite_index) { case sElderSeptogg_tlRock1AN: sprite_index = sSeptogg_tlRock1A; break; case sElderSeptogg_tlRock2NB: sprite_index = sSeptogg_tlRock2A; break; case sElderSeptogg_tlRock3A: sprite_index = sSeptogg_tlRock3A; break; case sElderSeptogg_tlRock4A: sprite_index = sSeptogg_tlRock4A; break; case sElderSeptogg_tlRock4B: sprite_index = sSeptogg_tlRock4B; break; case sElderSeptogg_tlRock5A: sprite_index = sSeptogg_tlRock5A; break; case sElderSeptogg_tlRock6A: sprite_index = sSeptogg_tlRock6A; break; case sElderSeptogg_tlGreenCrystals: if(irandom(99) < 15) sprite_index = sSeptogg_Rupee; else sprite_index = sSeptogg_tlGreenCrystals; break; default: switch (global.timeofday) { case 1: sprite_index = sSeptoggTwilight; break; case 2: sprite_index = sSeptoggNight; break; default: sprite_index = sSeptogg; } } 1 603 7 0 0 -1 2 self 0 0 1 /// Destroy random types if too close to some other entities. if (parent == -1 && scavenge == -1) { if(distance_to_object(oCharacter) < 48) instance_destroy(); if(distance_to_object(oEnemy) < 16) instance_destroy(); if(distance_to_object(oMEgg1) < 48) instance_destroy(); if(distance_to_object(oMEgg2) < 48) instance_destroy(); if(distance_to_object(oMEgg2A) < 48) instance_destroy(); } 1 603 7 0 0 -1 2 self 0 0 1 /// Destroy when Septogg leaves the room. if (oControl.widescreen) { if ((x < -(oControl.widescreen_space/2)) || (x > (room_width + (oControl.widescreen_space/2)))) { instance_destroy(); } } else instance_destroy(); 1 603 7 0 0 -1 2 self 0 0 1 /// Draw glowing eyes. var brightness = 0.8; if(instance_exists(oPBombExpl)) { brightness = 0.8 * (1 - (oPBombExpl.image_alpha * (1 - oPBombExpl.alpha2 * 0.2))); } if(global.darkness > 0 && eye_glow) { switch (sprite_index) { case sSeptogg_tlRock5A: draw_sprite_ext(sSeptoggEyes, 1, x, y, 1, 1, 0, c_white, brightness); break; case sSeptogg_tlGreenCrystals: draw_sprite_ext(sSeptoggEyes, 2, x, y, 1, 1, 0, c_white, brightness); break; case sSeptogg_Rupee: draw_sprite_ext(sSeptoggEyes, 2, x, y, 1, 1, 0, c_white, brightness); break; default: draw_sprite_ext(sSeptoggEyes, 0, x, y, 1, 1, 0, c_white, brightness); } } 0 0 0 0.5 0.100000001490116 0 0.100000001490116 0.100000001490116 0.200000002980232 -1 0