sokoban
Diffstat (limited to 'Target.gd')
| -rw-r--r-- | Target.gd | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Target.gd b/Target.gd new file mode 100644 index 0000000..bf970a5 --- /dev/null +++ b/Target.gd @@ -0,0 +1,28 @@ +extends Node + +onready var anim = $AnimationPlayer + +var main: Node2D +onready var circle = $Circle + + +func _on_Target_body_entered(body): + if body.is_in_group("crates"): + body.entered_target(self) + if not main.just_started: + play_pulse() + + +func _on_Target_body_exited(body): + if body.is_in_group("crates"): + body.left_target(self) + anim.play("Animate") + + +func r(): + return rand_range(0, 1) + + +func play_pulse(): + circle.self_modulate = Color(r(), r(), r(), 1) + anim.play("Animate") |