//Initiate checks
var a,pf_d,wat,typ;
typ = -1;
pf_d = place_free(x,y + 1);
if !pf_d
{
if place_meeting(x,y + 1,obj_block)
typ = instance_place(x,y + 1,obj_block);
if place_meeting(x,y + 1,obj_crackedblock)
typ = instance_place(x,y + 1,obj_crackedblock);
if place_meeting(x,y + 1,obj_enemy4)
typ = instance_place(x,y + 1,obj_enemy4);
}
if place_meeting(x,y + 1,obj_upblock)
{
a = instance_place(x,y + 1,obj_upblock);
if a.y > y and vspeed >= 0
pf_d = false;
if !pf_d
typ = instance_place(x,y + 1,obj_upblock);
}
wat = place_meeting(x,y,obj_water);
if !pf_d
ice = (typ.object_index == obj_iceblock || typ.object_index == obj_upiceblock);
//Lava
if typ != -1 {
if typ.object_index == obj_lava
{
candj = true;
vspeed = -4;
hurt(100);
typ = -1;
}
//Conveyors
if typ.object_index == obj_Rconveyor
or typ.object_index == obj_RconveyorR
or typ.object_index == obj_RconveyorL
or typ.object_index == obj_Lconveyor
or typ.object_index == obj_LconveyorR
or typ.object_index == obj_LconveyorL
{
repeat(abs(typ.image_speed * 3))
{
if place_free(x + sign(typ.image_speed),y)
x += sign(typ.image_speed);
}
}
//Moving platforms
if typ.object_index == obj_movingA {
repeat(abs(typ.hspeed)) {
if place_free(x + sign(typ.hspeed),y)
x += sign(typ.hspeed);
}
}
}
//Air depletion
if wat {
if place_meeting(x,y,obj_airbubbles) {
if global.wlife < global.st_mwl
global.wlife += 1;
} else {
if canair {
canair = false;
alarm[3] = 9-global.difficulty;
}
}
} else {
if global.wlife < global.st_mwl
global.wlife += 1;
}
//Moving left/right
if c_left()
and mask_index != spr_playerduck
and (mask_index != spr_playerroof or global.ability[11] == true)
and place_free(x - 1,y){
if !wat
hspeed -= (0.5 - 0.2*ice);
else
hspeed -= (0.3 - 0.1*ice);
} else {
if c_right()
and mask_index != spr_playerduck
and (mask_index != spr_playerroof or global.ability[11] == true)
and place_free(x + 1,y) {
if !wat
hspeed += (0.5 - 0.2*ice);
else
hspeed += (0.3 - 0.1*ice);
}
}
//Friction
if (!c_left() and !c_right())
or mask_index == spr_playerduck
or (mask_index == spr_playerroof and global.ability[11] == false) {
if pf_d
hspeed = reduce(hspeed,0.3 - (0.2*ice));
else
hspeed = reduce(hspeed,0.6 - (0.4*ice));
}
//Above limits come down
if !bounce {
if !wat {
if hspeed > 4 + global.gear
hspeed = max(4 + global.gear,hspeed-1);
if hspeed < -4 - global.gear
hspeed = min(-4 - global.gear,hspeed+1);
} else {
if hspeed > 3 + global.gear
hspeed = max(3+ global.gear,hspeed-1);
if hspeed < -3 - global.gear
hspeed = min(-3 - global.gear,hspeed+1);
}
} else {
if hspeed > blimitr hspeed = blimitr;
if hspeed < blimitl hspeed = blimitl;
}
//Gravity
if pf_d {
if !wat {
vspeed += 0.4;
if vspeed > 5 && !bounce
vspeed = max(5,vspeed-1);
} else {
vspeed += 0.2;
if vspeed > 3 && !bounce
vspeed = max(3,vspeed-1);
}
if c_down_all() and global.ability[13] == true
and vspeed >= 2 && !bounce {
if global.ability[32] == false
{
candj = false;
}
else {
if candj == true
{
candj = true;
}
else {
canj = false;
}
}
if !wat {
vspeed = 7;
repeat(3)
part_particles_create(global.p_sys_d,x - 4 + random(
,y - 6 + random(3),typ1,1);
} else {
vspeed = 5;
repeat(3)
part_particles_create(global.p_sys_d,x - 4 + random(
,y - 6 + random(3),typ2,1);
}
}
} else
candj = true;
//Jumping
if c_p_jump() && !bounce
{
if !pf_d
{
vspeed = -global.st_jh;
sound_play(snd_jump);
}
else
{
if candj == true and global.st_djh > 0 and mask_index == spr_player && !bounce && !nodj
{
sound_play(snd_djump);
candj = false;
vspeed = -global.st_djh;
}
}
}
//Variable Jumping
if !c_jump() and vspeed < -1 && !bounce
{
vspeed += 0.5;
vspeed = min(vspeed,-1);
}
//Sticking to the roof
mask_index = spr_player;
if global.ability[10] == true and pf_d
{
if !place_free(x,y - 1) and c_jump()
{
mask_index = spr_playerroof;
vspeed = 0;
if place_meeting(x,y - 1,obj_Rconveyor)
{
a = instance_place(x,y - 1,obj_Rconveyor);
repeat(abs(a.image_speed * 3))
{
if place_free(x + sign(a.image_speed * -1),y)
x += sign(a.image_speed * -1);
}
}
if place_meeting(x,y - 1,obj_movingA)
{
a = instance_place(x,y - 1,obj_movingA);
repeat(abs(a.hspeed))
{
if place_free(x + sign(a.hspeed),y)
x += sign(a.hspeed);
}
}
}
}
//Ducking
if global.ability[9] == true
{
if c_down() and !pf_d
{
mask_index = spr_playerduck;
}
else
{
if mask_index == spr_playerduck and place_free(x,y - 4)
{
mask_index = spr_player;
}
}
}
//Shooting
if !global.ability[21] { //If you DON'T have iceshot...
if c_p_shoot() && global.ability[14] == true && canshoot == true && mask_index != spr_playerroof
&& mask_index != spr_playerduck && !bounce {
if place_meeting(x,y,obj_water) {
if img_xscale == 1
part_particles_create(global.p_sys_b,x + 5,y,typ5,5);
else
part_particles_create(global.p_sys_b,x - 5,y,typ6,5);
exit;
}
canshoot = false;
alarm[2] = 30;
sound_play(snd_shoot);
instance_create(x,y,obj_playershot);
}
} else { //If you DO have iceshot...
if part_attractor_exists(global.p_sys_c,attr)
part_attractor_position(global.p_sys_c,attr,x,y);
else {
attr = part_attractor_create(global.p_sys_c);
part_attractor_force(global.p_sys_c,attr,1,30,ps_force_linear,true);
part_attractor_position(global.p_sys_c,attr,x,y);
}
a = c_shoot();
if c_p_shoot() and charge == 0 and canshoot && !bounce {
charge = 1;
canshoot = false;
alarm[2] = 30;
if place_meeting(x,y,obj_water) {
if img_xscale == 1
part_particles_create(global.p_sys_b,x + 5,y,typ5,5);
else
part_particles_create(global.p_sys_b,x - 5,y,typ6,5);
} else {
if mask_index != spr_playerroof && mask_index != spr_playerduck {
instance_create(x,y,obj_playershot);
sound_play(snd_shoot);
}
}
}
if a and charge > 0 {
if charge >= 5
part_particles_create(global.p_sys_c,x - 15 + random(30),y - 15 + random(30),typ7,1);
if charge == 39
sound_play(snd_charged);
if charge < 39 and charge >= 5 and !sound_isplaying(snd_charging)
sound_play(snd_charging);
charge = min(charge + 1,40);
}
if !a and charge > 0 {
if charge == 40 {
if mask_index != spr_playerroof && mask_index != spr_playerduck {
instance_create(x,y,obj_playershot2);
sound_play(snd_iceshoot);
}
canshoot = false;
alarm[2] = 30;
}
charge = 0;
}
}