0 votes

I don't understand why it isn't moving, it is in the correct child.

    extends KinematicBody2D

export var MOTION_SPEED = 140
var RayNode

func _ready():
    set_fixed_process(true)
    RayNode = get_node("RayCast2D")


func _fixed_process(delta):
    var motion = Vector2()

    if(Input.action_press("ui_up")):
        motion += Vector2(0, -1)
        RayNode.set_rotd(100)

    if(Input.action_press("ui_right")):
        motion += Vector2(1, 0)
        RayNode.set_rotd(100)

    if(Input.action_press("ui_left")):
        motion += Vector2(-1, 0)
        RayNode.set_rotd(100)

    if(Input.action_press("ui_down")):
        motion += Vector2(0, 1)
        RayNode.set_rotd(100)

        motion = motion.normalized()+MOTION_SPEED*delta
        move(motion)
in Engine by (162 points)

Is your indenting correct there, because you have the motion only happening if the down arrow is pressed?

Also, you probably want to use Input.is_action_pressed() here.

motion.normalized()+MOTION_SPEED*delta should probably be
motion.normalized()*MOTION_SPEED*delta

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.