15 lines
373 B
GDScript
15 lines
373 B
GDScript
extends KinematicBody2D
|
|
|
|
export var speed = 50
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
func _physics_process(delta):
|
|
var input_movement = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left"))
|
|
|
|
|
|
self.move_and_slide(Vector2(input_movement * speed, 0), Vector2(0, -1))
|