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.
352 lines
12 KiB
352 lines
12 KiB
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
|
|
<object>
|
|
<spriteName>sTsumuri</spriteName>
|
|
<solid>0</solid>
|
|
<visible>-1</visible>
|
|
<depth>-3</depth>
|
|
<persistent>0</persistent>
|
|
<parentName>oEnemy</parentName>
|
|
<maskName><undefined></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>action_inherited();
|
|
makeActive();
|
|
setCollisionBounds(-1, -1, 1, 1);
|
|
myhealth = 10;
|
|
damage = 6;
|
|
hitsound = sndEHit5;
|
|
deathsound = sndEDeath1;
|
|
platyoffset = -14;
|
|
frozenspr = sTsumuriFrozen;
|
|
image_speed = 0.2;
|
|
state = 1;
|
|
angle = 0;
|
|
shouldMove = true;
|
|
tsumuriState = 0;
|
|
tsumuriDirection = 0;
|
|
previousAngle = 0;
|
|
rotationSpeed = 0;
|
|
falling = false;
|
|
xVel = 0;
|
|
yVel = 0;
|
|
|
|
enum TsumuriStates{
|
|
FALLING,
|
|
BOTTOMFLOOR,
|
|
RIGHTWALL,
|
|
CEILING,
|
|
LEFTWALL,
|
|
INNERDOWNRIGHTWALL,
|
|
INNERUPRIGHTWALL,
|
|
INNERUPLEFTWALL,
|
|
INNERDOWNLEFTWALL,
|
|
OUTERUPRIGHTWALL,
|
|
OUTERDOWNRIGHTWALL,
|
|
OUTERDOWNLEFTWALL,
|
|
OUTERUPLEFTWALL
|
|
}
|
|
</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>// If Tsumuri is falling, make it fall faster
|
|
if(tsumuriState == TsumuriStates.FALLING) {
|
|
yVel += 0.1;
|
|
if (stun == 0) moveTo(xVel, yVel);
|
|
alarm[0] = 1;
|
|
}
|
|
else {
|
|
previousAngle = 0;
|
|
direction = angle;
|
|
image_angle = direction;
|
|
xVel = 0;
|
|
yVel = 0;
|
|
x = round(x);
|
|
y = round(y);
|
|
falling = false;
|
|
}
|
|
</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>enemy_active_check(20);
|
|
if (active == 1) instance_activate_region(x - 16, y - 16, 32, 32, 1);
|
|
|
|
|
|
if (room_width <= 320) { // just in case we have flush rooms, we don't want them crawling outside
|
|
if ((x < (-(oControl.widescreen_space/2) - 8)) || (x > (room_width + (oControl.widescreen_space/2) + 8)) || (y < 0) || (y > room_height)) {
|
|
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>action_inherited();
|
|
if (active == 1 && frozen == 0) {
|
|
shouldMove = !shouldMove;
|
|
|
|
// Run the movement code every other step, effectively resulting in 0.5 speed.
|
|
if(shouldMove){
|
|
event_user(1);
|
|
}
|
|
|
|
var inst1 = collision_line(x-2, y, x+2, y, oSolid, false, true),
|
|
inst2 = collision_line(x, y-2, x, y+2, oSolid, false, true),
|
|
inst = noone;
|
|
|
|
// If we're on Slopes, set our angle accordingly
|
|
if(instance_exists(inst1) && string_pos("Slope", object_get_name(inst1.object_index))) inst = inst1;
|
|
else if(instance_exists(inst2) && string_pos("Slope", object_get_name(inst2.object_index))) inst = inst2;
|
|
if(instance_exists(inst)) {
|
|
if(string_pos("1", object_get_name(inst.object_index))) angle = 45;
|
|
if(string_pos("2", object_get_name(inst.object_index))) angle = 315;
|
|
if(string_pos("3", object_get_name(inst.object_index))) angle = 225;
|
|
if(string_pos("4", object_get_name(inst.object_index))) angle = 135;
|
|
if(string_pos("1B", object_get_name(inst.object_index))) angle = 25;
|
|
if(string_pos("2B", object_get_name(inst.object_index))) angle = 334;
|
|
if(string_pos("3B", object_get_name(inst.object_index))) angle = 205;
|
|
if(string_pos("4B", object_get_name(inst.object_index))) angle = 154;
|
|
}
|
|
if(previousAngle != angle) {
|
|
rotationSpeed = (abs(angle_difference(angle, previousAngle))*15)/90;
|
|
previousAngle = angle;
|
|
}
|
|
if(falling == false) turn_towards_direction(angle, rotationSpeed);
|
|
image_angle = direction;
|
|
|
|
// Make Tsumuri fall if there's oQuake
|
|
if (instance_number(oQuake) > 0 && falling == false) {
|
|
if(image_angle >= 90 && image_angle <= 270) {
|
|
x = x + lengthdir_x(4, image_angle + 90);
|
|
y = y + lengthdir_y(4, image_angle + 90);
|
|
}
|
|
}
|
|
}
|
|
if (state == 100) enemy_death();
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="7" enumb="11">
|
|
<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>/// Tsumuris Movement Code
|
|
|
|
tsumuriState = TsumuriStates.FALLING;
|
|
edgedl = position_meeting(x - 2, y + 1, oSolid); // down-left
|
|
edgedr = position_meeting(x + 2, y + 1, oSolid); // down-right
|
|
edgeul = position_meeting(x - 2, y - 2, oSolid); // up-left
|
|
edgeur = position_meeting(x + 2, y - 2, oSolid); // up-right
|
|
|
|
if (isCollisionBottom(0) == 1) y -= 1;
|
|
if (isCollisionTop(0) == 1) y += 1;
|
|
if (isCollisionLeft(0) == 1) x += 1;
|
|
if (isCollisionRight(0) == 1) x -= 1;
|
|
|
|
// We save the results from Collision checks, in order to only need to call them once
|
|
var tempCollisionRight = isCollisionRight(1);
|
|
var tempCollisionLeft = isCollisionLeft(1);
|
|
var tempCollisionBottom = isCollisionBottom(1);
|
|
var tempCollisionTop = isCollisionTop(1);
|
|
|
|
if (tempCollisionBottom && !tempCollisionRight && !tempCollisionLeft) tsumuriState = TsumuriStates.BOTTOMFLOOR;
|
|
if (tempCollisionRight && !tempCollisionBottom && !tempCollisionTop) tsumuriState = TsumuriStates.RIGHTWALL;
|
|
if (tempCollisionTop && !tempCollisionRight && !tempCollisionLeft) tsumuriState = TsumuriStates.CEILING;
|
|
if (tempCollisionLeft && !tempCollisionBottom && !tempCollisionTop) tsumuriState = TsumuriStates.LEFTWALL;
|
|
|
|
if (tempCollisionBottom && tempCollisionRight) tsumuriState = TsumuriStates.INNERDOWNRIGHTWALL;
|
|
if (tempCollisionTop && tempCollisionRight) tsumuriState = TsumuriStates.INNERUPRIGHTWALL;
|
|
if (tempCollisionTop && tempCollisionLeft) tsumuriState = TsumuriStates.INNERUPLEFTWALL;
|
|
if (tempCollisionBottom && tempCollisionLeft) tsumuriState = TsumuriStates.INNERDOWNLEFTWALL;
|
|
|
|
if (!tempCollisionRight && !tempCollisionLeft && !tempCollisionBottom && !tempCollisionTop) {
|
|
if (edgedl == 1 && edgeul == 0 && edgeur == 0 && edgedr == 0) tsumuriState = TsumuriStates.OUTERUPRIGHTWALL;
|
|
if (edgeul == 1 && edgedl == 0 && edgeur == 0 && edgedr == 0) tsumuriState = TsumuriStates.OUTERDOWNRIGHTWALL;
|
|
if (edgeur == 1 && edgedl == 0 && edgeul == 0 && edgedr == 0) tsumuriState = TsumuriStates.OUTERDOWNLEFTWALL;
|
|
if (edgedr == 1 && edgedl == 0 && edgeul == 0 && edgeur == 0) tsumuriState = TsumuriStates.OUTERUPLEFTWALL;
|
|
|
|
if (edgedl == 1 && edgeul == 0 && edgeur == 0 && edgedr == 1) tsumuriState = TsumuriStates.BOTTOMFLOOR;
|
|
if (edgedl == 0 && edgeul == 0 && edgeur == 1 && edgedr == 1) tsumuriState = TsumuriStates.RIGHTWALL;
|
|
if (edgedl == 0 && edgeul == 1 && edgeur == 1 && edgedr == 0) tsumuriState = TsumuriStates.CEILING;
|
|
if (edgedl == 1 && edgeul == 1 && edgeur == 0 && edgedr == 0) tsumuriState = TsumuriStates.LEFTWALL;
|
|
}
|
|
|
|
// falling
|
|
if (tsumuriState == TsumuriStates.FALLING && falling == false) {
|
|
falling = true;
|
|
if(image_angle > 270 || image_angle < 90) xVel = 0.5 * facing;
|
|
if(image_angle > 90 && image_angle < 270) xVel = -0.5 * facing;
|
|
alarm[0] = 1;
|
|
}
|
|
if (tsumuriDirection == 0) {
|
|
switch (tsumuriState){
|
|
case TsumuriStates.BOTTOMFLOOR:
|
|
case TsumuriStates.INNERDOWNRIGHTWALL:
|
|
case TsumuriStates.INNERDOWNLEFTWALL:
|
|
case TsumuriStates.OUTERUPRIGHTWALL:
|
|
case TsumuriStates.OUTERUPLEFTWALL: tsumuriDirection = facing; break;
|
|
case TsumuriStates.CEILING:
|
|
case TsumuriStates.INNERUPRIGHTWALL:
|
|
case TsumuriStates.INNERUPLEFTWALL:
|
|
case TsumuriStates.OUTERDOWNRIGHTWALL:
|
|
case TsumuriStates.OUTERDOWNLEFTWALL: tsumuriDirection = -facing; break;
|
|
}
|
|
}
|
|
|
|
// Move tsumuris according to their state
|
|
switch (tsumuriState){
|
|
case TsumuriStates.BOTTOMFLOOR:
|
|
angle = 0;
|
|
x += tsumuriDirection;
|
|
break;
|
|
case TsumuriStates.RIGHTWALL:
|
|
angle = 90;
|
|
y -= tsumuriDirection;
|
|
break;
|
|
case TsumuriStates.CEILING:
|
|
angle = 180;
|
|
x -= tsumuriDirection;
|
|
break;
|
|
case TsumuriStates.LEFTWALL:
|
|
angle = 270;
|
|
y += tsumuriDirection
|
|
break;
|
|
case TsumuriStates.INNERDOWNRIGHTWALL:
|
|
if (tsumuriDirection == 1) y -= 1;
|
|
if (tsumuriDirection == -1) x -= 1;
|
|
break;
|
|
case TsumuriStates.INNERUPRIGHTWALL:
|
|
if (tsumuriDirection == 1) x -= 1;
|
|
if (tsumuriDirection == -1) y += 1;
|
|
break;
|
|
case TsumuriStates.INNERUPLEFTWALL:
|
|
if (tsumuriDirection == 1) y += 1;
|
|
if (tsumuriDirection == -1) x += 1;
|
|
break;
|
|
case TsumuriStates.INNERDOWNLEFTWALL:
|
|
if (tsumuriDirection == 1) x += 1;
|
|
if (tsumuriDirection == -1) y -= 1;
|
|
break;
|
|
case TsumuriStates.OUTERUPRIGHTWALL:
|
|
if (tsumuriDirection == 1) y += 1;
|
|
if (tsumuriDirection == -1) x -= 1;
|
|
break;
|
|
case TsumuriStates.OUTERDOWNRIGHTWALL:
|
|
if (tsumuriDirection == 1) x -= 1;
|
|
if (tsumuriDirection == -1) y -= 1;
|
|
break;
|
|
case TsumuriStates.OUTERDOWNLEFTWALL:
|
|
if (tsumuriDirection == 1) y -= 1;
|
|
if (tsumuriDirection == -1) x += 1;
|
|
break;
|
|
case TsumuriStates.OUTERUPLEFTWALL:
|
|
if (tsumuriDirection == 1) x += 1;
|
|
if (tsumuriDirection == -1) y += 1;
|
|
break;
|
|
}
|
|
</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>
|