![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | asdasdasd |
Im trying to learn from this tutorial https://www.youtube.com/watch?v=mAbG8Oi-SvQ&t=388s and at 23:55 is where im having trouble, hes able to substitute “position.x” with “velocity.x” and im unable to move in the demo/test when i do it. My script below
extends KinematicBody2D
var velocity = Vector2.ZERO
func _physics_process(delta):
if Input.is_action_pressed(“ui_right”):
position.x += 4
if Input.is_action_pressed(“ui_left”):
position.x += -4
if Input.is_action_pressed(“ui_up”):
position.y += -4
if Input.is_action_pressed(“ui_down”):
position.y += 4
indents and underscores are there, it works fine when i use “position.x”