sokoban
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
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")