giraffe/scripts/GiraffeHead.gd

17 lines
413 B
GDScript
Raw Permalink Normal View History

2021-02-06 19:50:01 +00:00
extends KinematicBody2D
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):
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))