diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
commit | 72863ffa31e27f4c6be862d80472cfb897fccaea (patch) | |
tree | ce04be8d77b10c797c8ff854c8ff1a219eb1af46 /Effects | |
parent | 63d2a59042fb9d90a586ad85d8364de7c38aea8e (diff) |
next commit
Diffstat (limited to 'Effects')
-rw-r--r-- | Effects/Effect.gd | 2 | ||||
-rw-r--r-- | Effects/PoisonEffect.tscn | 6 | ||||
-rw-r--r-- | Effects/SlowEffect.gd | 4 | ||||
-rw-r--r-- | Effects/burn_effect.gd | 7 | ||||
-rw-r--r-- | Effects/poison_effect.gd | 31 |
5 files changed, 43 insertions, 7 deletions
diff --git a/Effects/Effect.gd b/Effects/Effect.gd index f1662a7..0c74c2b 100644 --- a/Effects/Effect.gd +++ b/Effects/Effect.gd @@ -11,6 +11,8 @@ var DurationTimer: Timer var tick: float = 0.0 var TickTimer: Timer +var is_stackable := false + func _ready(): pass diff --git a/Effects/PoisonEffect.tscn b/Effects/PoisonEffect.tscn new file mode 100644 index 0000000..c7e6fbe --- /dev/null +++ b/Effects/PoisonEffect.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://bkg0ehkbm3b7n"] + +[ext_resource type="Script" path="res://Effects/poison_effect.gd" id="1_tyodc"] + +[node name="PoisonEffect" type="Node2D"] +script = ExtResource("1_tyodc") diff --git a/Effects/SlowEffect.gd b/Effects/SlowEffect.gd index 622a97e..fd33fe6 100644 --- a/Effects/SlowEffect.gd +++ b/Effects/SlowEffect.gd @@ -24,10 +24,10 @@ func _ready(): func add(): - unit.sprite.self_modulate = Color(0, 0, 1) + unit.sprite.modulate += Color(0, 0, 1, 0) unit.speed -= unit.base_speed * magnitude func remove(): - unit.sprite.self_modulate = Color(1, 1, 1) + unit.sprite.modulate -= Color(0, 0, 1, 0) unit.speed += unit.base_speed * magnitude diff --git a/Effects/burn_effect.gd b/Effects/burn_effect.gd index 2e8bf7d..fe62f37 100644 --- a/Effects/burn_effect.gd +++ b/Effects/burn_effect.gd @@ -6,8 +6,6 @@ extends Effect var level := 1 var power := 0.0 -var base_modulate: Color - func _ready(): power = 5.0 + (level - 1) @@ -16,9 +14,8 @@ func _ready(): set_tick(1.0) tick_finished.connect(func(): - base_modulate = unit.sprite.self_modulate unit.set_hp(unit.hp - power) - unit.sprite.self_modulate = Color(1, 0, 0) + unit.sprite.modulate += Color(1, 0, 0, 0) await get_tree().create_timer(0.1).timeout - unit.sprite.self_modulate = base_modulate + unit.sprite.modulate -= Color(1, 0, 0, 0) ) diff --git a/Effects/poison_effect.gd b/Effects/poison_effect.gd new file mode 100644 index 0000000..b04786d --- /dev/null +++ b/Effects/poison_effect.gd @@ -0,0 +1,31 @@ +extends Effect + + +@onready var unit: Unit = get_parent() + +var level := 1 +var power := 0.0 + + +func _init() -> void: + is_stackable = true + + +func _ready(): + power = 1.0 + (level - 1) + + set_duration(2.0 + ((level - 1) * 0.1)) + + set_tick(1.0) + tick_finished.connect(func(): + unit.set_hp(unit.hp - power) + await get_tree().create_timer(0.1).timeout + ) + + +func add(): + unit.sprite.modulate += Color(0, 1, 0, 0) + + +func remove(): + unit.sprite.modulate -= Color(0, 1, 0, 0) |