2021-02-06 19:50:01 +00:00
|
|
|
extends KinematicBody2D
|
|
|
|
|
2021-02-13 19:46:37 +00:00
|
|
|
export var speed = 5
|
2021-02-06 19:50:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
2021-02-13 19:46:37 +00:00
|
|
|
if Input.is_action_pressed("right"):
|
|
|
|
self.move_and_collide(Vector2(speed,0))
|
|
|
|
$Sprite.flip_h = true
|
|
|
|
elif Input.is_action_pressed("left"):
|
|
|
|
$Sprite.flip_h = false
|
|
|
|
self.move_and_collide(Vector2(-speed,0))
|