diff options
Diffstat (limited to 'scenes/defenders/base_animation_handler.gd')
-rw-r--r-- | scenes/defenders/base_animation_handler.gd | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scenes/defenders/base_animation_handler.gd b/scenes/defenders/base_animation_handler.gd new file mode 100644 index 0000000..c9e7630 --- /dev/null +++ b/scenes/defenders/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() |