Windows [SOLVED] Gap under character error (need collision help and advice)



I'm new here, so bare with me :)
- I have recently started working in GM, and I've enjoyed it immensely so far.

Here's my question.
I see to be having some collision(?) problems with my character.
Sometimes when I jump and land on a surface there's a small pixel gap (1-3 usually) between the character and the surface.
Also, this is the first game I've tried to make.
It's obviously nothing, but it's just me training myself.

I jump down: (GAP!)

Then, I fall from the left ledge and land: (NO GAP!)

It's random, too. I can't seem to purposely replicate the error, it just... happens.

Here's my code for the Step event:

///Movement Engine & Stretching
//Get the player's input
key_right = keyboard_check(ord("D"));
key_left = -keyboard_check(ord("A"));
key_jump = keyboard_check_pressed(ord("W"));
if (key_jump = 1 && place_meeting(x,y+1,obj_floor)) {
    draw_yscale = 1.5; 
    draw_xscale = .75;
if (place_meeting(x,y+1,obj_floor) && land = 0) {
    land = 1;
if (!place_meeting(x,y+1,obj_floor)) {
    land = 0;
//React to Inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;
//Jumping & Sprite Changes
    //Sprite Stationary
if (place_meeting(x,y+1,obj_floor) && move = 0)
    vsp = key_jump * -jumpspeed;
    sprite_index = spr_player;
    //Sprite to LEFT
} else if (place_meeting(x,y+1,obj_floor) && move = -1) {
    vsp = key_jump * -jumpspeed;
    sprite_index = spr_playerLeft;
    //Sprite to JUMP LEFT
} else if (!place_meeting(x,y+1,obj_floor) && move = -1) {
    sprite_index = spr_playerJumpLeft;
    //Sprite to RIGHT
} else if (place_meeting(x,y+1,obj_floor) && move = 1) {
    vsp = key_jump * -jumpspeed;
    sprite_index = spr_playerRight;
    //Sprite to JUMP RIGHT
} else if (!place_meeting(x,y+1,obj_floor) && move = 1) {
    sprite_index = spr_playerJumpRight;
    //Sprite to JUMP (stationary)
} else if (!place_meeting(x,y+1,obj_floor) && move = 0) {
    sprite_index = spr_playerJump;
//Horizontal Collision
if (place_meeting(x+hsp,y,obj_floor))
        while(!place_meeting(x+sign(hsp),y,obj_floor)) x += sign(hsp);
        hsp = 0;
x += hsp;

//Vertical Collision
if (place_meeting(x,y+vsp,obj_floor))
    while(!place_meeting(x,y+sign(vsp),obj_floor)) y += sign(vsp);
    vsp = 0;
y += vsp;
//Strech Lerping

draw_xscale = lerp(draw_xscale, 1, .1);
draw_yscale = lerp(draw_yscale, 1, .1);

if (place_meeting(x,y+1,obj_floor) and !place_meeting(x,yprevious+1,obj_floor)) {
    draw_xscale = 1.25;
Thanks in advance for any help! If anybody needs any more information, I'll provide it.



Either because of your draw_xscale and draw_yscale stuff, or because your vsp is a fraction due to fractional gravity at some point which sets your y to a fraction, so fraction+1 is still a fraction and the way GM rounds fractions is to the nearest even value. So perhaps falling from the previous ledge sets you at the nearest fraction to the floor while the other doesn't. Try checking if the y coordinate rounded off +1 is in a collision.


Either because of your draw_xscale and draw_yscale stuff...
Just tested the draw_xscale and draw_yscale, no change. How would I check your second suggestion? I'm sorry for my ineptitude haha

EDIT: NEVERMIND! I got that working, except now since the y value is rounded the vertical moving isn't as smooth (as would be expected), maybe I'll try when the character lands to round the y value.