summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/basketball.gd19
-rw-r--r--scripts/interface.gd13
2 files changed, 20 insertions, 12 deletions
diff --git a/scripts/basketball.gd b/scripts/basketball.gd
index 9001e68..7a50f69 100644
--- a/scripts/basketball.gd
+++ b/scripts/basketball.gd
@@ -13,7 +13,8 @@ onready var start_maximum = $"../Hoop".position.x - 40
var is_dragging = false
var waiting_for_shoot = true
var mouse_over_ball = false
-var difficulty_phase = 1
+var phase = 1
+var phase_increment = [5, 15, 25, 35, 45, 55]
func _ready():
start_position = global_position
@@ -86,19 +87,19 @@ func _on_InnerShape_mouse_exited():
func position_changer():
# Progressive
- if difficulty_phase == 1:
+ if phase == 1:
start_position.x -= 20
start_position.x = clamp(start_position.x, start_minimum, start_maximum)
# Random
- if difficulty_phase == 2:
+ if phase == 2:
start_position.x = rand_range(start_minimum, start_maximum)
func _on_Hoop_score():
- if global_variables.score >= 5 and global_variables.score < 15:
- difficulty_phase = 2
- if global_variables.score >= 15 and global_variables.score < 25:
+ if global_variables.score >= phase_increment[0] and global_variables.score < phase_increment[1]:
+ phase = 2
+ if global_variables.score >= phase_increment[1] and global_variables.score < phase_increment[2]:
start_minimum = (drag_radius * 2) + $"../Camera2D".limit_left
- difficulty_phase = 1
- if global_variables.score >= 25 and global_variables.score < 35:
- difficulty_phase = 2
+ phase = 1
+ if global_variables.score >= phase_increment[2] and global_variables.score < phase_increment[3]:
+ phase = 2
position_changer()
diff --git a/scripts/interface.gd b/scripts/interface.gd
index 4a25ce3..6aab7dd 100644
--- a/scripts/interface.gd
+++ b/scripts/interface.gd
@@ -1,16 +1,23 @@
extends CanvasLayer
var time_left = 30
+var phase_index = 0
func _ready():
- $ScoreLabel.text = "Score: " + str(global_variables.score)
- $TimerLabel.text = "Time: " + str(time_left)
+ update_labels()
$Timer.start()
func _on_Hoop_score():
- $ScoreLabel.text = "Score: " + str(global_variables.score)
time_left += 10
+ update_labels()
+
+func update_labels():
update_timer()
+ $ScoreLabel.text = "Score: " + str(global_variables.score)
+ if phase_index < $"../Basketball".phase_increment.size() - 1:
+ if $"../Basketball".phase_increment[phase_index] <= global_variables.score:
+ phase_index += 1
+ $PhaseLabel.text = "Next Phase: " + str($"../Basketball".phase_increment[phase_index] - global_variables.score)
func update_timer():
$TimerLabel.text = "Time: " + str(time_left)