Files
AM2R-Community-Updates/objects/oBattery.object.gmx
2020-12-22 20:54:55 -06:00

482 lines
14 KiB
XML

<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sBattery</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>5</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>setCollisionBounds(-4, -4, 4, 4);
makeActive();
state = 0;
statetime = 0;
targetx = 0;
targety = 0;
shaking = 0;
fxtimer = 0;
event = -1;
alarm[1] = 1;
/*
xVelSub = 0;
yVelSub = 0;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="1">
<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>if (event &gt; -1) {
if (global.event[event] &gt; 0 &amp;&amp; state != 10) instance_destroy();
}
</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>spark = instance_create(x, y, oFXAnimSpark);
spark.sprite_index = sBatterySpark;
spark.image_speed = 0.5;
spark.additive = 1;
spark.image_xscale = choose(1, -1);
spark.image_yscale = choose(1, -1);
spark.image_angle = random(360);
spark.depth = 4;
alarm[0] = 20 + random(40);
if (state == 10) alarm[0] = 10;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="1">
<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>instance_activate_region(x - 64, y - 64, 128, 128, 1);
</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>if (state == 0) {
if (isCollisionBottom(5) == 0) yVel += 0.1;
if (isCollisionBottom(5) &gt; 0) {
if (yVel &gt; 0) yVel *= -0.7;
if (abs(yVel) &lt; 0.3) yVel = 0;
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope1, true, true) &gt; 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL1, true, true) &gt; 0) {
xVel -= 0.5;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope2, true, true) &gt; 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL2, true, true) &gt; 0) {
xVel += 0.5;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope1B, true, true) &gt; 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL1B, true, true) &gt; 0) {
xVel -= 0.2;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope2B, true, true) &gt; 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL2B, true, true) &gt; 0) {
xVel += 0.2;
yVel *= 0.5;
}
xVel *= 0.9;
}
if (isCollisionTop(5) &gt; 0 &amp;&amp; yVel &lt; 0) {
yVel *= -1;
xVel *= 0.9;
}
if (isCollisionRight(5) &gt; 0 &amp;&amp; xVel &gt; 0 || isCollisionLeft(5) &gt; 0 &amp;&amp; xVel &lt; 0) xVel *= -0.8;
xVel = min(xVel, 6);
xVel = max(xVel, -6);
yVel = min(yVel, 6);
yVel = max(yVel, -6);
/*xVel += xVelSub; // add sub velocity
yVel += yVelSub;
xVelSub = xVel - floor(xVel); // calculate and store excess
yVelSub = yVel - floor(yVel);
xVel = floor(xVel); // round down
yVel = floor(yVel);*/
moveTo(xVel, yVel);
image_angle += xVel * -2;
} // if (state == 0)
if (state == 10) {
x = round(x);
y = round(y);
if (x &gt; targetx) x -= 1;
if (x &lt; targetx) x += 1;
if (y &gt; targety) y -= 1;
if (y &lt; targety) y += 1;
}
if (state == 100) {
shaking = 1;
if (statetime == 30) {
instance_create(x, y, oBatteryExpl);
expl = instance_create(x, y, oBatteryExpl);
expl.image_angle = 90;
expl = instance_create(x, y, oBatteryExpl);
expl.image_angle = 180;
expl = instance_create(x, y, oBatteryExpl);
expl.image_angle = 270;
sfx_play(sndEMPExpl);
instance_destroy();
}
if (fxtimer &lt; 5) {
fxtimer += 1;
} else fxtimer = 0;
statetime += 1;
}
if ((x &lt; (-8 - (oControl.widescreen_space/2))) || (x &gt; (room_width + 8 + (oControl.widescreen_space/2))) || (y &lt; -8) || (y &gt; (room_height + 8))) instance_destroy();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oMZetaSlashProj2">
<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>if (state == 0) event_user(0);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oMZetaSlashProj">
<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>if (state == 0) event_user(0);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oBeam">
<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>if (state == 0) {
event_user(0);
with (other) {
event_user(0);
instance_destroy();
}
sfx_play(sndEMPHit);
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oMissileExpl">
<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>x = round(x);
y = round(y);
var offset;
offset = other.x - x;
yVel = -3;
xVel = offset / 8 * -1;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oBombExpl">
<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>x = round(x);
y = round(y);
var offset;
offset = other.x - x;
yVel = -3;
xVel = offset / 8 * -1;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oBatterySlot">
<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>if (state != 10 &amp;&amp; other.active == 0) {
state = 10;
statetime = 0;
targetx = other.x + 8;
targety = other.y + 8;
alarm[0] = 1;
with (other) {
active = 1;
alarm[0] = 90;
}
sfx_play(sndEMPHit);
sfx_play(sndBirdSwitchEnable);
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="oBatteryExpl">
<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>if (state == 0) event_user(0);
</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>state = 100;
statetime = 0;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" 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>var xoff, yoff;
if (!shaking) draw_sprite_ext(sprite_index, -1, x, y, 1, 1, image_angle, -1, 1);
if (shaking) {
xoff = random_range(-1, 1);
yoff = random_range(-1, 1);
draw_sprite_ext(sprite_index, -1, x + xoff, y + yoff, image_xscale, 1, image_angle, make_color_rgb(80, 80, 80), 1);
draw_set_blend_mode(bm_add);
repeat (3) draw_sprite_ext(sprite_index, -1, x + xoff, y + yoff, image_xscale, 1, image_angle, -1, 1 - fxtimer * 0.25);
draw_set_blend_mode(bm_normal);
}
</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>-1</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>