blob: a3070ca89345eebfe272b6078d4a10d3966934c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
extends Effect
@onready var unit: Unit = get_parent()
var base_speed: float
var magnitude: float = 0.5 :
set(value):
magnitude = clamp(value, 0.0, 1.0)
func _ready():
add()
set_duration(5.0)
duration_finished.connect(func():
remove()
)
func add():
unit.get_node("Sprite2D").self_modulate = Color(0, 0, 1)
unit.speed -= unit.base_speed * magnitude
func remove():
unit.get_node("Sprite2D").self_modulate = Color(1, 1, 1)
unit.speed += unit.base_speed * magnitude
|