Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | cenuh |
Hello,
problem is the following:
The player node stops before touching the ground?
I don’t know why, here is a screen from my godot:
The CollisionShape2D fits perfectly over the player, the same is in the TileMap,
over every tile is a perfectly fitting CollisionShape2D. What is wrong?
Here is the code im using:
extends KinematicBody2D
const GRAVITY = 20
const SPEED = 200
const UP = Vector2(0,-1)
const JUMP_HEIGHT = -500
var motion = Vector2()
func _physics_process(delta):
#gravity
motion.y += GRAVITY
if Input.is_action_pressed("ui_right"):
motion.x = SPEED
elif Input.is_action_pressed("ui_left"):
motion.x = -SPEED
else:
motion.x = 0
if is_on_floor():
if Input.is_action_just_pressed("ui_up"):
motion.y = JUMP_HEIGHT
motion = move_and_slide(motion, UP)
pass
Thanks a lot!