Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Seth |
I must be doing something wrong, because my player character just keeps going through the floor I made? This isn’t the first time I’ve done this, and it’s worked before! But for the life of me I can’t figure out what’s wrong this time.
Here is the setup I have:
(the floor is a door because it’s what was on my desktop)
There are the nodes:
the code looks like this:
extends KinematicBody2D
const UP = Vector2(0,-1)
const SPEED = 200
const GRAVITY = 10
const JUMP = 500
var motion = Vector2( )
func _physics_process(delta):
motion.y += GRAVITY
if Input.is_action_pressed("move_left"):
motion.x = -SPEED
elif Input.is_action_pressed("move_right"):
motion.x = SPEED
else:
motion.x = 0
move_and_slide(motion)
And this is what happens, and I can’t figure out why
It’s probably something really simple, so like… please help.