diff options
Diffstat (limited to 'Effects')
-rw-r--r-- | Effects/BurnEffect.tscn | 6 | ||||
-rw-r--r-- | Effects/SlowEffect.gd | 14 | ||||
-rw-r--r-- | Effects/burn_effect.gd | 20 |
3 files changed, 31 insertions, 9 deletions
diff --git a/Effects/BurnEffect.tscn b/Effects/BurnEffect.tscn new file mode 100644 index 0000000..a8e1ed0 --- /dev/null +++ b/Effects/BurnEffect.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://dmj3et5exg4s5"] + +[ext_resource type="Script" path="res://Effects/burn_effect.gd" id="1_8my4q"] + +[node name="BurnEffect" type="Node2D"] +script = ExtResource("1_8my4q") diff --git a/Effects/SlowEffect.gd b/Effects/SlowEffect.gd index 27dcc59..a3070ca 100644 --- a/Effects/SlowEffect.gd +++ b/Effects/SlowEffect.gd @@ -12,15 +12,11 @@ var magnitude: float = 0.5 : func _ready(): - if self.name != "SlowEffect" and unit.has_node("SlowEffect"): - unit.get_node("SlowEffect").set_duration(5.0) - queue_free() - else: - add() - set_duration(5.0) - duration_finished.connect(func(): - remove() - ) + add() + set_duration(5.0) + duration_finished.connect(func(): + remove() + ) func add(): diff --git a/Effects/burn_effect.gd b/Effects/burn_effect.gd new file mode 100644 index 0000000..9693292 --- /dev/null +++ b/Effects/burn_effect.gd @@ -0,0 +1,20 @@ +extends Effect + + +@onready var unit: Unit = get_parent() + +var base_modulate: Color + + +func _ready(): + base_modulate = unit.get_node("Sprite2D").self_modulate + + set_duration(5.0) + + set_tick(1.0) + tick_finished.connect(func(): + unit.set_hp(unit.hp - 5) + unit.get_node("Sprite2D").self_modulate = Color(1, 0, 0) + await get_tree().create_timer(0.1).timeout + unit.get_node("Sprite2D").self_modulate = base_modulate + ) |