sPlayer
0
-1
0
-1
<undefined>
<undefined>
1
603
7
0
0
-1
2
self
0
0
1
///Initialize
image_index = 2;
image_speed = 0;
fireTimer = 0;
//Precalculate possible blend values for the HTML5 version
if(os_browser != browser_not_a_browser) {
for(var i = 0; i <= ceil(sqrt(sqr(10) + sqr(4))); i++) {
blends[i] = make_color_rgb(255 - i * 10, 255 - i * 10, 255 - i * 10)
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Land movement
var inst = noone;
if(!place_meeting(x, y, Water)) {
if(place_meeting(x, y + sign(vspeed) + vspeed, Wall)) { //Vertical movement
if(vspeed > 0) { //Land on the floor
var snd = audio_play_sound(aLand, 0, false);
audio_sound_gain(snd, vspeed / 10, 0);
vspeed = 0;
y = floor(y);
while(!place_meeting(x, y + 1, Wall)) {
y++;
}
instance_create(x - 8 - 8, y, Puff);
instance_create(x + 8, y, Puff);
} else if(vspeed < 0) { //Hit the ceiling
vspeed = 0;
y = ceil(y + 1);
while(!place_meeting(x, y - 1, Wall)) {
y--;
}
}
}
if(place_meeting(x, y + 1, Wall)) { //Jump if allowed
if(!place_meeting(x, y - 8, Wall)) {
if(input_check_pressed(I_JUMP)) {
vspeed = -8;
audio_sound_gain(audio_play_sound(aJump, 0, false), 0.5, 0);
}
}
} else {
vspeed += 0.5;
}
vspeed = clamp(vspeed, -10, 10); //Speed limits
if(input_check(I_HAXIS) != 0) {
inst = instance_place(x + input_check(I_HAXIS), y, Crate);
if(inst != noone) { //Pre-check for crate movement
if(Controller.colours[BROWN]) {
crate_precheck(inst);
}
}
}
if(!place_meeting(x + input_check(I_HAXIS), y, Wall)) { //Move if no walls
hspeed += (input_check(I_HAXIS) * 0.5);
if(place_meeting(x, y + 1, Wall)) {
if(input_check_pressed(I_HAXIS) > 0) {
instance_create(x - 8 - 8, y, Puff);
} else if(input_check_pressed(I_HAXIS) < 0) {
instance_create(x + 8, y, Puff);
}
}
}
if(input_check(I_HAXIS) != sign(hspeed)) { //Slow down
hspeed -= sign(hspeed) * min(abs(hspeed), 1);
}
if(hspeed != 0) {
if(inst != noone) { //Move crate
if(inst.vspeed == 0) {
if(Controller.colours[BROWN]) {
hspeed = sign(hspeed) * 2;
if(hspeed > 0) {
x = floor(x);
} else {
x = ceil(x);
}
crate_move(inst);
}
}
}
}
if(place_meeting(x + hspeed, y, Wall)) { //Stop at walls
if(hspeed > 0) {
x = floor(x);
} else if(hspeed < 0) {
x = ceil(x);
}
while(!place_meeting(x + sign(hspeed), y, Wall)) {
x += sign(hspeed);
}
hspeed = 0;
}
hspeed = clamp(hspeed, -4, 4); //Speed limits
if(place_meeting(x + hspeed, y + vspeed, Wall)) { //Final checks to prevent getting stuck in walls
if(!place_meeting(x + hspeed, y, Wall)) {
vspeed = 0;
} else if(!place_meeting(x, y + vspeed, Wall)) {
hspeed = 0;
} else if(!place_meeting(x, y, Wall)) {
hspeed = 0;
vspeed = 0;
} else {
var m = 1, n = 1;
while(place_meeting(x + m, y, Wall)) {
m = -sign(m) * ((m < 0) * 1 + (abs(m)));
}
while(place_meeting(x, y + n, Wall)) {
n = -sign(n) * ((n < 0) * 1 + (abs(n)));
}
if(abs(m) < abs(n)) {
x += m;
} else {
y += n;
}
}
}
if(place_meeting(x + hspeed, y + vspeed, Water)) { //Splash if landing in the water
if(!place_meeting(x + hspeed, y, Water)) {
instance_create(x + hspeed, floor((y + vspeed) / 16) * 16, Splash);
var sound = audio_play_sound(aSplash, 0, false);
audio_sound_gain(sound, vspeed / 5, 0);
audio_sound_gain(sound, 0, (vspeed / 5) * 1000);
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Water movement
var inst = noone;
if(place_meeting(x, y, Water)) {
fireTimer = 0; //Put out fires
if(!irandom(60)) { //Make bubbles sometimes
if(place_meeting(x, y - 32, Water)) {
instance_create(x + 16 * sign(hspeed), y - 32, Bubble);
}
}
if(!place_meeting(x, y - abs(vspeed - 3), Wall)) { //Jump
if(input_check_pressed(I_JUMP)) {
vspeed -= 3
audio_sound_gain(audio_play_sound(aSwim, 0, false), 0.15, 0);
}
}
vspeed += 0.2; //Gravity
if(place_meeting(x, y + sign(vspeed) + vspeed, Wall)) { //Stop at walls
if(vspeed > 0) { //Land on the floor
y = floor(y);
while(!place_meeting(x, y + 1, Wall)) {
y++;
}
if(vspeed != 0.2) { //Create puffs on the ground ignoring gravity
instance_create(x - 8 - 8, y, Puff);
instance_create(x + 8, y, Puff);
audio_sound_gain(audio_play_sound(aLand, 0, false), 0.2, 0);
}
vspeed = 0;
} else if(vspeed < 0) { //Hit the ceiling
vspeed = 0;
y = ceil(y + 1);
while(!place_meeting(x, y - 1, Wall)) {
y--;
}
}
}
vspeed = clamp(vspeed, -3, 5); //Speed limits
if(input_check(I_HAXIS) != 0) {
inst = instance_place(x + input_check(I_HAXIS), y, Crate); //Pre-check for crate movement
if(inst != noone) {
if(Controller.colours[BROWN]) {
crate_precheck(inst); //Move away all crates in the way if possible
}
}
}
if(!place_meeting(x + input_check(I_HAXIS), y, Wall)) { //Horizontal movement, if no walls
hspeed += (input_check(I_HAXIS) * 0.5);
if(place_meeting(x, y + 1, Wall)) {
if(input_check_pressed(I_HAXIS) > 0) {
instance_create(x - 8 - 8, y, Puff);
} else if(input_check_pressed(I_HAXIS) < 0) {
instance_create(x + 8, y, Puff);
}
}
}
if(input_check(I_HAXIS) != sign(hspeed)) { //Slow down
hspeed -= sign(hspeed) * min(abs(hspeed), 1);
}
if(hspeed != 0) {
if(inst != noone) { //Move crate
if(inst.vspeed == 0) {
if(Controller.colours[BROWN]) {
hspeed = sign(hspeed) * 2;
if(hspeed > 0) {
x = floor(x);
} else {
x = ceil(x);
}
crate_move(inst);
}
}
}
}
if(place_meeting(x + hspeed, y, Wall)) { //Stop at walls
if(hspeed > 0) {
x = floor(x);
} else if(hspeed < 0) {
x = ceil(x);
}
while(!place_meeting(x + sign(hspeed), y, Wall)) { //Perfect collision
x += sign(hspeed);
}
hspeed = 0;
}
hspeed = clamp(hspeed, -3, 3); //Speed limits
if(place_meeting(x + hspeed, y + vspeed, Wall)) { //Final checks to prevent getting stuck in walls
if(!place_meeting(x + hspeed, y, Wall)) {
vspeed = 0;
} else if(!place_meeting(x, y + vspeed, Wall)) {
hspeed = 0;
} else if(!place_meeting(x, y, Wall)) {
hspeed = 0;
vspeed = 0;
} else {
var m = 1, n = 1;
while(place_meeting(x + m, y, Wall)) {
m = -sign(m) * ((m < 0) * 1 + (abs(m)));
}
while(place_meeting(x, y + n, Wall)) {
n = -sign(n) * ((n < 0) * 1 + (abs(n)));
}
if(abs(m) < abs(n)) {
x += m;
} else {
y += n;
}
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Final 'cutscene'
if(room == rLongFall && Controller.state[0] >= S_HAPPYOLDGUY) {
var inst = instance_place(x, y, Door);
hspeed = -2;
vspeed = 0;
if(inst != noone) {
if(inst.thisID == 0) {
if(inst.x >= x) {
instance_destroy();
room_goto(rWhite);
}
}
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Grid snap and animation
image_index = 2 + floor(abs(hspeed) / 2) * sign(hspeed);
var col;
if(os_browser == browser_not_a_browser) {
col = make_color_rgb(255 - abs(speed) * 10, 255 - abs(speed) * 10, 255 - abs(speed) * 10);
} else {
col = blends[ceil(abs(speed))];
}
image_blend = col;
1
603
7
0
0
-1
2
self
0
0
1
///Do fire stuff
if(fireTimer) {
var inst = instance_place(x, y, Torch);
if(inst != noone) { //Light other torches
if(!inst.lit) {
inst.lit = true;
inst.beenlit = true;
fireTimer = 0;
var snd = audio_play_sound(aFire, 0, false);
}
}
if(fireTimer) { //Go out gradually
fireTimer--;
}
}
1
603
7
0
0
-1
2
self
0
0
1
///Drop the fire in new rooms
fireTimer = 0;
1
603
7
0
0
-1
2
self
0
0
1
///Draw self and fire if there is one
draw_self();
if(fireTimer != 0) {
draw_sprite_ext(sFire, (fireTimer div 3) % 3, x + (sign(hspeed) * 2 * abs(image_index - 2)), y - 32,
1, 1, 0, c_white, fireTimer / (8 * room_speed));
}
0
0
0
0.5
0.100000001490116
0
0.100000001490116
0.100000001490116
0.200000002980232
-1
0
12,32
16,16