From 8c5c4863aeacb4afcf70f339df6d601e2df1a7a6 Mon Sep 17 00:00:00 2001 From: bd Date: Thu, 22 May 2025 13:50:49 -0400 Subject: Reorganized files into scenes and scripts --- scripts/base_animation_handler.gd | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/base_animation_handler.gd (limited to 'scripts/base_animation_handler.gd') diff --git a/scripts/base_animation_handler.gd b/scripts/base_animation_handler.gd new file mode 100644 index 0000000..c9e7630 --- /dev/null +++ b/scripts/base_animation_handler.gd @@ -0,0 +1,24 @@ +extends Sprite2D + +@onready var tile_map = preload("res://assets/tilemap.png") + +var idle : Rect2 +var attack : Rect2 +var is_idle : bool = true + +func _ready(): + update_texture() + +func update_texture(): + var atlas_texture = AtlasTexture.new() + atlas_texture.atlas = tile_map + atlas_texture.region = idle if is_idle else attack + texture = atlas_texture + +func attack_state(): + is_idle = false + update_texture() + +func idle_state(): + is_idle = true + update_texture() -- cgit v1.2.3