-
Notifications
You must be signed in to change notification settings - Fork 0
/
PartContainer.gd
59 lines (49 loc) · 1.23 KB
/
PartContainer.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
extends VBoxContainer
var PP = preload("res://PartPickup.gd").new()
var parts = []
var orig_colors = []
# Called when the node enters the scene tree for the first time.
func _ready():
self.parts = [
$Part1,
$Part2,
$Part3,
$Part4,
$Part5,
$Part6,
$Part7,
$Part8,
$Part9,
]
self.orig_colors = [
$Part1.modulate,
$Part2.modulate,
$Part3.modulate,
$Part4.modulate,
$Part5.modulate,
$Part6.modulate,
$Part7.modulate,
$Part8.modulate,
$Part9.modulate,
]
blah(9)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func blah(cunt):
var part
for i in range(cunt - 2, -1, -1):
part = self.parts[i]
part.modulate = self.orig_colors[i].darkened(0.5)
part = self.parts[cunt - 1]
part.rect_min_size = Vector2(64, 64)
part.modulate = self.orig_colors[cunt - 1]
func _new_parts_needed(p):
for i in range(0, 9):
if i < p.size():
parts[i].texture = PP.texture_lookup[p[i]]
parts[i].show()
else:
parts[i].hide()
parts[i].rect_min_size = Vector2(32, 32)
blah(p.size())