Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | szaross |
Hi. Can anyone help me with this error? I don’t really get it. Here is a snippet:
func _input(event):
if(event.is_action_pressed("interact")):
print(canInteract)
if(event.is_action_pressed("interact") and canInteract):
print(self.get_collider())
canMove = false
func movePlayer():
velocity = Vector2()
if Input.is_action_pressed("DOWN"):
velocity.y += 1
if Input.is_action_pressed("UP"):
velocity.y -= 1
if Input.is_action_pressed("LEFT"):
velocity.x -= 1
if Input.is_action_pressed("RIGHT"):
velocity.x += 1
velocity= velocity.normalized() * speed
func _physics_process(delta):
if (canMove == true):
movePlayer()
velocity = move_and_collide(velocity)
it extends KinematicBody2D ofc.