-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlowerDisplay.gd
More file actions
218 lines (151 loc) · 7.49 KB
/
FlowerDisplay.gd
File metadata and controls
218 lines (151 loc) · 7.49 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
extends ScrollContainer
# [Daisy,Rose]
@onready var FlowerBuff = ["MarginContainer/VBoxContainer/DaisyFlower/MarginContainer/HBoxContainer/VBoxContainer/FlowerBuff1",
"MarginContainer/VBoxContainer/RoseFlower/MarginContainer/HBoxContainer/VBoxContainer/FlowerBuff2",
"MarginContainer/VBoxContainer/TulipFlower/MarginContainer/HBoxContainer/VBoxContainer/FlowerBuff3",
"MarginContainer/VBoxContainer/OrchidFlower/MarginContainer/HBoxContainer/VBoxContainer/FlowerBuff4"]
@onready var FlowerCost = ["MarginContainer/VBoxContainer/DaisyFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade1/HBoxContainer/FlowerLabel1",
"MarginContainer/VBoxContainer/RoseFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade2/HBoxContainer/FlowerLabel2",
"MarginContainer/VBoxContainer/TulipFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade3/HBoxContainer/FlowerLabel3",
"MarginContainer/VBoxContainer/OrchidFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade4/HBoxContainer/FlowerLabel4",]
@onready var FlowerStep = ["MarginContainer/VBoxContainer/DaisyFlower/FlowerGenerate1",
"MarginContainer/VBoxContainer/RoseFlower/FlowerGenerate2",
"MarginContainer/VBoxContainer/TulipFlower/FlowerGenerate3",
"MarginContainer/VBoxContainer/OrchidFlower/FlowerGenerate4"]
@onready var FlowerLabel = ["MarginContainer/VBoxContainer/DaisyFlower/MarginContainer/HBoxContainer/VBoxContainer/FlowerLabel1",
"MarginContainer/VBoxContainer/RoseFlower/MarginContainer/HBoxContainer/VBoxContainer/Label",
"MarginContainer/VBoxContainer/TulipFlower/MarginContainer/HBoxContainer/VBoxContainer/Label",
"MarginContainer/VBoxContainer/OrchidFlower/MarginContainer/HBoxContainer/VBoxContainer/Label"]
@onready var FlowerButton = ["MarginContainer/VBoxContainer/DaisyFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade1",
"MarginContainer/VBoxContainer/RoseFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade2",
"MarginContainer/VBoxContainer/TulipFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade3",
"MarginContainer/VBoxContainer/OrchidFlower/MarginContainer/HBoxContainer/MarginContainer2/Upgrade4",]
@onready var TimerIndex
@onready var TimerRun;
@onready var UpgradeNotReady = load("res://theme/PrimaryTheme.tres")
@onready var UpgradeReady = load("res://theme/SecondaryTheme.tres")
# Called when the node enters the scene tree for the first time.
func _ready():
pass
func _process(_delta):
get_node(FlowerLabel[0]).text = "Daisy Flower Lv " + str(Game.flower1[0])
get_node(FlowerLabel[1]).text = "Rose Flower Lv " + str(Game.flower2[0])
get_node(FlowerLabel[2]).text = "Tulip Flower Lv " + str(Game.flower3[0])
get_node(FlowerLabel[3]).text = "Orchid Flower Lv " + str(Game.flower4[0])
for i in range(FlowerBuff.size()):
get_node(FlowerCost[i]).text = str(Game.convertnumber(floor(Game["flower" + str(i + 1)][2])))
get_node(FlowerStep[i]).value = Game["flower" + str(i + 1)][5]
get_node(FlowerStep[i]).max_value = Game["flower" + str(i + 1)][4]
if (Game["flower" + str(i + 1)][0] > 0):
Game["flower" + str(i + 1)][5] += 1 + ((Game.upgrade3[1] * Game.upgrade3[5]) / 100)
# if (Game.flower1[0] > 0):
# get_node(FlowerBuff[0]).visible = true
# else:
# get_node(FlowerBuff[0]).visible = false
for i in range(FlowerBuff.size()):
if (Game["flower" + str(i + 1)][0] > 0):
get_node(FlowerBuff[i]).visible = true
else:
get_node(FlowerBuff[i]).visible = false
for i in range(FlowerBuff.size()):
if ( Game.bubble >= Game["flower" + str(i + 1)][2]):
get_node(FlowerButton[i]).theme = UpgradeReady
else:
get_node(FlowerButton[i]).theme = UpgradeNotReady
if (Game.bubble > Game.flower1[2]):
get_node(FlowerBuff[0]).text = str(Game.flower1[1]) + " > " + str(Game.flower1[1] + (Game.flower1[3] * Game.flower1[7])) + " x Bubble per click"
else:
get_node(FlowerBuff[0]).text = str(Game.flower1[1]) + "x Bubble per click"
if (Game.bubble > Game.flower2[2]):
get_node(FlowerBuff[1]).text = str(Game.flower2[1]) + " > " + str(Game.flower2[1] + (Game.flower2[3] * Game.flower2[7] )) + " x Bubble per second"
else:
get_node(FlowerBuff[1]).text = str(Game.flower2[1]) + "x Bubble per second"
if (Game.bubble > Game.flower3[2]):
get_node(FlowerBuff[2]).text = str(Game.flower3[1]) + " > " + str(Game.flower3[1] + (Game.flower3[3] * Game.flower3[7] )) + " x all upgrades"
else:
get_node(FlowerBuff[2]).text = str(Game.flower3[1]) + "x all upgrades"
if (Game.bubble > Game.flower4[2]):
get_node(FlowerBuff[3]).text = str(Game.convertnumber(Game.flower4[1])) + " > " + str(Game.convertnumber(Game.flower4[1] + (Game.flower4[3] * Game.flower4[7]))) + " x flower level"
else:
get_node(FlowerBuff[3]).text = str(Game.convertnumber(Game.flower4[1])) + "x all flower level"
if (Game.flower1[5] >= Game.flower1[4]):
Game.bubble += ((Game.flower1[1] * Game.upgrade1[1]) * Game.flower1[7])
Game.flower1[5] = 0
if (Game.flower2[5] >= Game.flower2[4]):
Game.bubble += ((Game.flower2[1] * Game.BPS) * Game.flower2[7])
Game.flower2[5] = 0
if (Game.flower3[5] >= Game.flower3[4]):
Game.bubble += ((Game.flower3[1] * (Game.BPS + Game.click)) * Game.flower3[7])
Game.flower3[5] = 0
if (Game.flower4[5] >= Game.flower4[4]):
Game.bubble += ((Game.flower4[1] * (Game.flower1[0] + Game.flower2[0] + Game.flower3[0])) * Game.flower4[7])
Game.flower4[5] = 0
if (Game.flower1[0] > 0):
$MarginContainer/VBoxContainer/RoseFlower.visible = true
else:
$MarginContainer/VBoxContainer/RoseFlower.visible = false
if (Game.flower2[0] > 0):
$MarginContainer/VBoxContainer/TulipFlower.visible = true
else:
$MarginContainer/VBoxContainer/TulipFlower.visible = false
if (Game.flower3[0] > 0):
$MarginContainer/VBoxContainer/OrchidFlower.visible = true
else:
$MarginContainer/VBoxContainer/OrchidFlower.visible = false
func _on_upgrade_1_pressed():
upgrade(Game.flower1)
func _on_upgrade_2_pressed():
upgrade(Game.flower2)
func upgrade(UpgradeIndex):
#var UpgradeIndex = index;
if (Game.bubble >= UpgradeIndex[2]):
Game.bubble -= UpgradeIndex[2];
UpgradeIndex[0] += 1
UpgradeIndex[1] += (UpgradeIndex[3] * UpgradeIndex[7])
UpgradeIndex[2] += UpgradeIndex[2] * 0.25
if (UpgradeIndex[0] == Game.UpgradeStep[UpgradeIndex[6]] - 1):
UpgradeIndex[6] += 1
UpgradeIndex[7] += 0.25
UpgradeIndex[2] += UpgradeIndex[2] * 0.30
if (UpgradeIndex[0] == 1 && UpgradeIndex == Game.flower1):
UpgradeIndex[1] += 10
if (UpgradeIndex[0] == 1 && UpgradeIndex == Game.flower2):
UpgradeIndex[1] += 25
if (UpgradeIndex[0] == 1 && UpgradeIndex == Game.flower3):
UpgradeIndex[1] += 50
func _on_upgrade_3_pressed():
upgrade(Game.flower3)
func _on_upgrade_1_button_down():
$UpgradeLoop.start()
TimerRun = 0.1
TimerIndex = Game.flower1
func _on_upgrade_2_button_down():
$UpgradeLoop.start()
TimerRun = 0.1
TimerIndex = Game.flower2
func _on_upgrade_3_button_down():
$UpgradeLoop.start()
TimerRun = 0.1
TimerIndex = Game.flower3
func _on_upgrade_loop_timeout():
$UpgradeLoop.set_wait_time(TimerRun)
upgrade(TimerIndex)
TimerRun -= 0.005
func _on_upgrade_1_button_up():
TimerRun = 0.1
$UpgradeLoop.stop()
func _on_upgrade_2_button_up():
TimerRun = 0.1
$UpgradeLoop.stop()
func _on_upgrade_3_button_up():
TimerRun = 0.1
$UpgradeLoop.stop()
func _on_upgrade_4_button_down():
$UpgradeLoop.start()
TimerRun = 0.1
TimerIndex = Game.flower4
func _on_upgrade_4_button_up():
TimerRun = 0.1
$UpgradeLoop.stop()
func _on_upgrade_4_pressed():
upgrade(Game.flower4)