0 votes


I dont really know how to put it, so I hope you understand what I mean.
While moving or jumping there is a "half pixel gap" between the kinematicbody2d and the tile map.
Here's a gif to properly show what I'm talking about.
This is the players movement script:

func move():
var useFriction = false

# movement
if Input.is_action_pressed("ui_left"):
    $AnimatedSprite.set_flip_h(true) # flip sprite to face into correct direction

    motion.x -= ACCELERATION; # add acceleration to move to left
    motion.x = max(motion.x, -MAX_SPEED) # use motion.x only if its smaller than the max speed
elif Input.is_action_pressed("ui_right"):
    $AnimatedSprite.set_flip_h(false) # flip sprite to face into correct direction

    motion.x += ACCELERATION
    motion.x = min(motion.x, MAX_SPEED)
    useFriction = true

# jump
if is_on_floor():
    if Input.is_action_just_pressed("ui_up"):
        motion.y = JUMP_HEIGHT
        jumpSound = get_node("jumpy")

    if useFriction == true:
        motion.x = lerp(motion.x, 0, FRICTION_GROUND)

    if useFriction == true:
        motion.x = lerp(motion.x, 0, FRICTION_AIR) # the friction in the air should be less than on the ground

The player sprite is 14x26 px and the game size is 480x270.

Thanks in advance!

in Engine by (12 points)

hi, did you fixed it? i have same problem

1 Answer

0 votes

Maybe the idle animation does something weird? Please do share the project files

by (997 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.