Untitled

 avatar
unknown
plain_text
23 days ago
647 B
2
Indexable
var grounded = position_meeting(x, y + 1, _tilemap);


if (place_meeting(x, y + vsp, obj_crate)) {
    
	obj_crate.hsp = 0;
	
	// provide a window to jump
    if (keyboard_check_pressed(ord("W"))) {
		vsp += vspJump
		allow_jump_duration = 8;
	}
	
	// provide a window to get down the rock
    if (keyboard_check_pressed(ord("S"))) {
		vsp -= vspJump
		allow_jump_duration = 8;
	}
	
	// stop vertical movement when not jumping
	if (allow_jump_duration <= 0) {
        vsp = 0;
		vsp -= grv;
    }
	
	// allows the rock to get pushed (assuming we are on the ground)
	if (grounded) {
		obj_crate.hsp = hsp * hspWalk;
	}
}

allow_jump_duration -= 1;
Leave a Comment