diff options
author | bd <bdunahu@operationnull.com> | 2025-05-22 13:50:49 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-05-22 13:50:49 -0400 |
commit | 8c5c4863aeacb4afcf70f339df6d601e2df1a7a6 (patch) | |
tree | 6c2af54a18271534864a7a1daed7814ebac5abd1 /scripts/base_animation_handler.gd | |
parent | 80e145ba2b85e08f895e76ba6a03bb67bc9ce9ea (diff) |
Reorganized files into scenes and scripts
Diffstat (limited to 'scripts/base_animation_handler.gd')
-rw-r--r-- | scripts/base_animation_handler.gd | 24 |
1 files changed, 24 insertions, 0 deletions
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() |