-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtile.gd
35 lines (28 loc) · 940 Bytes
/
tile.gd
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
30
31
32
33
34
35
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var neighbor_list = []
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func set_neighbors(neighbors):
self.neighbor_list = neighbors
func test_neighbors():
var neighbor_count = 0
for i in range(len(neighbor_list)):
if neighbor_list[i] != null && neighbor_list[i].visible:
neighbor_count += 1
if self.visible && neighbor_count < 2:
return false
elif self.visible && neighbor_count > 3:
return false
elif not self.visible && neighbor_count == 3:
return true
elif self.visible && (neighbor_count == 2 || neighbor_count == 3):
return true
else:
return false
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass