Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | 12bits |
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