sBattery
0
-1
5
0
<undefined>
<undefined>
1
603
7
0
0
-1
2
self
0
0
1
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;
1
603
7
0
0
-1
2
self
0
0
1
if (event > -1) {
if (global.event[event] > 0 && state != 10) instance_destroy();
}
1
603
7
0
0
-1
2
self
0
0
1
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;
1
603
7
0
0
-1
2
self
0
0
1
instance_activate_region(x - 64, y - 64, 128, 128, 1);
1
603
7
0
0
-1
2
self
0
0
1
if (state == 0) {
if (isCollisionBottom(5) == 0) yVel += 0.1;
if (isCollisionBottom(5) > 0) {
if (yVel > 0) yVel *= -0.7;
if (abs(yVel) < 0.3) yVel = 0;
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope1, true, true) > 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL1, true, true) > 0) {
xVel -= 0.5;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope2, true, true) > 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL2, true, true) > 0) {
xVel += 0.5;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope1B, true, true) > 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL1B, true, true) > 0) {
xVel -= 0.2;
yVel *= 0.5;
}
if (collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlope2B, true, true) > 0 || collision_line(round(lb), round(bb + 4), round(rb - 1), round(bb + 4), oSlopeFL2B, true, true) > 0) {
xVel += 0.2;
yVel *= 0.5;
}
xVel *= 0.9;
}
if (isCollisionTop(5) > 0 && yVel < 0) {
yVel *= -1;
xVel *= 0.9;
}
if (isCollisionRight(5) > 0 && xVel > 0 || isCollisionLeft(5) > 0 && xVel < 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 > targetx) x -= 1;
if (x < targetx) x += 1;
if (y > targety) y -= 1;
if (y < 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 < 5) {
fxtimer += 1;
} else fxtimer = 0;
statetime += 1;
}
if ((x < (-8 - (oControl.widescreen_space/2))) || (x > (room_width + 8 + (oControl.widescreen_space/2))) || (y < -8) || (y > (room_height + 8))) instance_destroy();
1
603
7
0
0
-1
2
self
0
0
1
if (state == 0) event_user(0);
1
603
7
0
0
-1
2
self
0
0
1
if (state == 0) event_user(0);
1
603
7
0
0
-1
2
self
0
0
1
if (state == 0) {
event_user(0);
with (other) {
event_user(0);
instance_destroy();
}
sfx_play(sndEMPHit);
}
1
603
7
0
0
-1
2
self
0
0
1
x = round(x);
y = round(y);
var offset;
offset = other.x - x;
yVel = -3;
xVel = offset / 8 * -1;
1
603
7
0
0
-1
2
self
0
0
1
x = round(x);
y = round(y);
var offset;
offset = other.x - x;
yVel = -3;
xVel = offset / 8 * -1;
1
603
7
0
0
-1
2
self
0
0
1
if (state != 10 && 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);
}
1
603
7
0
0
-1
2
self
0
0
1
if (state == 0) event_user(0);
1
603
7
0
0
-1
2
self
0
0
1
state = 100;
statetime = 0;
1
603
7
0
0
-1
2
self
0
0
1
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);
}
0
0
0
0.5
0.100000001490116
0
0.100000001490116
0.100000001490116
0.200000002980232
-1
-1