0 votes

I've attached a basic script to my player, but not of my code is executing.
This is my script

extends KinematicBody2D

export (int) var speed = 200

var velocity = Vector2()

# Called when the node enters the scene tree for the first time.
func _ready():
    print("hello")
    pass # Replace with function body.

func get_input():
    velocity = Vector2()
    if Input.is_action_pressed("move_right"):
        velocity.x =+ 1
    if Input.is_action_pressed("move_left"):
        velocity.x -= 1
    if Input.is_action_pressed("move_down"):
        velocity.y += 1
    if Input.is_action_pressed("move_up"):
        velocity.y -= 1
    velocity = velocity * speed


func _physics_process(delta):
    get_input()
    velocity = move_and_slide(velocity)

This is my node set up

enter image description here

asked Jan 14 in Engine by 12bits (24 points)

1 Answer

0 votes

check that the action entries ("move_down", "move_up", etc.) are defined in Project> Project settings> Input map tab.

answered Jan 15 by estebanmolca (648 points)

Out of curiosity, is that print ("hello") printed? If this is not the case, the problem is another.

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.