You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AM2R-TimeTrials/objects/oBabySeptogg.object.gmx

480 lines
14 KiB

<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sSeptogg</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>90</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// 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 &amp;&amp; global.timeofday == 2) orbit_amplitude*=1.25;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// 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();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Septogg Movement
timer_x++;
if(timer_x &gt; 2 * pi/frequency_x) timer_x -= 2 * pi/frequency_x;
timer_y++;
if(timer_y &gt; 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) &gt; 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) &lt; 64 &amp;&amp; (oCharacter.state != oCharacter.STANDING)) ||
(instance_exists(oBeam) &amp;&amp; point_distance(x, y, oBeam.x, oBeam.y) &lt; 64) ||
(instance_exists(oMissile) &amp;&amp; point_distance(x, y, oMissile.x, oMissile.y) &lt; 64) ||
(instance_exists(oPBombExpl) &amp;&amp; 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&gt;oCharacter.y &amp;&amp; point_distance(x, y, oCharacter.x, oCharacter.y) &lt; 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 &amp;&amp; flyoff = 0)
y = lerp(y, target_pop, 0.125);
else
flyoff = 1;
}
statetime += 1;
}
if(flyoff) {
speed += exit_acceleration;
if(speed &gt; 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 &gt; 0) {
if(point_distance(x, y, oCharacter.x, oCharacter.y-24) &lt; 160) {
var playerdirection = point_direction(oCharacter.x, oCharacter.y-24, x, y);
turn_towards_direction(playerdirection, turnspeed);
}
}
x += xx;
y += yy;
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="10">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// 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;
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// 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) &lt; 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;
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="4">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Destroy random types if too close to some other entities.
if (parent == -1 &amp;&amp; scavenge == -1) {
if(distance_to_object(oCharacter) &lt; 48) instance_destroy();
if(distance_to_object(oEnemy) &lt; 16) instance_destroy();
if(distance_to_object(oMEgg1) &lt; 48) instance_destroy();
if(distance_to_object(oMEgg2) &lt; 48) instance_destroy();
if(distance_to_object(oMEgg2A) &lt; 48) instance_destroy();
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Destroy when Septogg leaves the room.
if (oControl.widescreen) {
if ((x &lt; -(oControl.widescreen_space/2)) || (x &gt; (room_width + (oControl.widescreen_space/2)))) {
instance_destroy();
}
} else instance_destroy();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="73">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// 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 &gt; 0 &amp;&amp; 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);
}
}
</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>