gravity_direction=270
if (place_free(x,y+1) == false and instance_place(x,y+1,object3) != fallpast) { //if there's something under you that isn't the one that was under you when you pressed down
downing = false //downing is whether you're allowed to fall past any blocks
}
obj3n = 0 //this is the number of floor objects your touching
with (object3) { //this makes each floor object do the following
if (instance_place(x,y+1,trevor) == other.id) //if it's touching you
other.obj3n += 1
}
if (instance_place(x,y+1,object3) == noone or downing == true or (instance_place(x,y+1,object3).y < y+90 and (obj3n == 1 or obj3n == 2))) {
/*For the above if statement:
1: if there is nothing under you
2: if you're allowed to fall past any blocks
3: if you're mostly under the block, but not completely and you're not touching more than two blocks
*/
gravity=0.5
sprite_index=trevor_jump
} else {
if vspeed >= 0 {
vspeed = 0
gravity = 0
} else {
gravity=0.5
sprite_index=trevor_jump
}
if keyboard_check(vk_left) {
sprite_index=trevor_run_L
}
if keyboard_check(vk_right) {
sprite_index=trevor_run_R
}
if (!(keyboard_check(vk_left) xor keyboard_check(vk_right)) and vspeed == 0) {
sprite_index=trevor_still_R
}
if keyboard_check(vk_down) && keyboard_check(ord('X')){
fallpast = instance_place(x,y+1,object3) //this is the block that is under you
downing = true //this is whether you're allowed to fall past any blocks
}
if !keyboard_check(vk_down) if (keyboard_check(ord('X')) == true and vspeed == 0)
vspeed = -12
}
vspeed = min(vspeed,3)
{if keyboard_check(ord('Z')) && keyboard_check(vk_right)
sprite_index=trevor_run_shoot_R
if keyboard_check(ord('Z')) && keyboard_check(vk_left)
sprite_index=trevor_run_shoot_L
if keyboard_check(vk_down) sprite_index=trevor_crouch}