1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-21 15:44:23 +00:00

Create SpriteLeftRight behaviour

This commit is contained in:
Steffo 2024-04-15 05:43:07 +02:00
parent 0a1f302c77
commit 2b513b8bb2
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,13 @@
extends Sprite2D
class_name SpriteLeftRight
@export var left_texture: Texture2D
@export var right_texture: Texture2D
func handle_move(movement: Vector2):
if movement.x > 0:
texture = right_texture
else:
texture = left_texture

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bxbjfev0lhwws"]
[ext_resource type="Script" path="res://behaviours/sprite_left_right.gd" id="1_mt6ma"]
[node name="SpriteLeftRight" type="Sprite2D"]
script = ExtResource("1_mt6ma")