summaryrefslogtreecommitdiff
path: root/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts')
-rw-r--r--Scripts/GameLoop.gd15
-rw-r--r--Scripts/NumberNode.gd17
2 files changed, 18 insertions, 14 deletions
diff --git a/Scripts/GameLoop.gd b/Scripts/GameLoop.gd
index 9edc99a..5d3c3f4 100644
--- a/Scripts/GameLoop.gd
+++ b/Scripts/GameLoop.gd
@@ -37,22 +37,19 @@ func _on_between_player_and_ai_timeout():
else: turn_label.text = ""
if current_turns >= turns:
+ $"AudioDelay".start()
+
+func _on_audio_delay_timeout():
win_control.visible = true
anim.play("win")
anim_label.size = Vector2(1280, 720)
- if GlobalVariables.player.get_node("..").value > GlobalVariables.ai.get_node("..").value:
- anim_label.text = "YOU won!"
- elif GlobalVariables.player.get_node("..").value < GlobalVariables.ai.get_node("..").value:
- anim_label.text = "AI won!"
- else:
- anim_label.text = "It's a TIE!"
- $"AudioDelay".start()
-
-func _on_audio_delay_timeout():
if GlobalVariables.player.get_node("..").value > GlobalVariables.ai.get_node("..").value:
+ anim_label.text = "YOU won!"
win_control.get_node("Win").play()
elif GlobalVariables.player.get_node("..").value < GlobalVariables.ai.get_node("..").value:
win_control.get_node("Lose").play()
+ anim_label.text = "AI won!"
else:
win_control.get_node("Win").play()
+ anim_label.text = "It's a TIE!"
diff --git a/Scripts/NumberNode.gd b/Scripts/NumberNode.gd
index b15f535..10a12e7 100644
--- a/Scripts/NumberNode.gd
+++ b/Scripts/NumberNode.gd
@@ -48,16 +48,21 @@ func _physics_process(_delta):
func join_from(node : NumberNode):
var prev_value = node.value
+ self.stored_prev_value = prev_value
node.value += self.value
+
if self.modifier_operation != Operations.NONE:
+ stored_node = node
+ self.stored_prev_value = node.value
$"ModifierTimer".start()
GlobalVariables.gameloop.get_node("BetweenPlayerAndAI").wait_time = 2
- stored_node = node
- stored_prev_value = prev_value
+ if GlobalVariables.gameloop.current_turns + 1 >= GlobalVariables.gameloop.turns:
+ GlobalVariables.gameloop.get_node("AudioDelay").wait_time = 2
else:
GlobalVariables.gameloop.get_node("BetweenPlayerAndAI").wait_time = 1
+ GlobalVariables.gameloop.get_node("AudioDelay").wait_time = 1
node.target_pos = self.position
node.update_visuals()
@@ -111,7 +116,6 @@ func softlock_check():
func _on_modifier_timer_timeout():
var node = stored_node
- var prev_value = stored_prev_value
var modifier_label = node.get_node_or_null("Control/ModifierLabel")
@@ -130,10 +134,13 @@ func _on_modifier_timer_timeout():
node.get_node("Control/AnimationPlayer").play("mod")
node.update_visuals()
-
- if node.value >= prev_value:
+
+ if node.value >= self.stored_prev_value:
+ print(str(node.value) + " >= " + str(self.stored_prev_value))
node.get_node("Score").playing = true
else:
node.get_node("Ouch").playing = true
+
+ self.stored_prev_value = node.value
queue_free()