aboutsummaryrefslogtreecommitdiffstats
path: root/godot/scripts
diff options
context:
space:
mode:
authorLibravatar IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com>2022-07-17 02:49:09 +0200
committerLibravatar IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com>2022-07-17 02:49:09 +0200
commit4961e6a3f51990bb053cd8b18827e39aaf3e4e7c (patch)
tree41387099b13b6aca4ac69cdb3a1124a85825d600 /godot/scripts
parent88aeae3f02bfb19b83212599ac1eb950beb805b3 (diff)
parent8b932533e6d25a80f185bae299351426a4ca157e (diff)
download2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.tar.gz
2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.tar.bz2
2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.zip
Merge branch 'Scoreboard'
Diffstat (limited to 'godot/scripts')
-rw-r--r--godot/scripts/GoalTriggerBox.gd6
-rw-r--r--godot/scripts/LevelLoader.gd55
2 files changed, 3 insertions, 58 deletions
diff --git a/godot/scripts/GoalTriggerBox.gd b/godot/scripts/GoalTriggerBox.gd
index 17e98ad..6e1034b 100644
--- a/godot/scripts/GoalTriggerBox.gd
+++ b/godot/scripts/GoalTriggerBox.gd
@@ -1,11 +1,11 @@
extends Area
-const Loader = preload("res://scripts/LevelLoader.gd")
+const Loader = preload("res://scenes/Game.gd")
var loader: Loader = null
# Called when the node enters the scene tree for the first time.
func _ready():
- loader = get_node("/root/Game/LevelLoader")
+ loader = get_node("/root/Game")
# Called every frame. 'delta' is the elapsed time since the previous frame.
@@ -18,5 +18,5 @@ func _on_Area2_body_entered(body: RigidBody):
if body == null:
return
- loader.load_next_level()
+ loader.end_level()
diff --git a/godot/scripts/LevelLoader.gd b/godot/scripts/LevelLoader.gd
deleted file mode 100644
index 2aec587..0000000
--- a/godot/scripts/LevelLoader.gd
+++ /dev/null
@@ -1,55 +0,0 @@
-extends Node
-
-const NUM_LEVELS = 9
-
-# player node
-var player: Spatial = null
-
-# level control
-var current_level_id = 0
-var levels = []
-
-# stroke control
-var current_strokes = 0
-var strokes_per_level = []
-
-# Called when the node enters the scene tree for the first time.
-func _ready():
- for i in range(NUM_LEVELS):
- levels.append(get_node("/root/Game/Level%d" % (i+1)))
-
- current_strokes = 0
- levels[0].show()
-
- player = get_node("/root/Game/PlayerRoot")
-
-
-# Called every frame. 'delta' is the elapsed time since the previous frame.
-#func _process(delta):
-# pass
-
-func load_next_level():
- levels[current_level_id].hide()
- current_level_id = current_level_id + 1
-
- if current_level_id >= NUM_LEVELS:
- # TODO load main menu
- return
-
- # load next level
- levels[current_level_id].show()
-
- # save current strokes and reset
- strokes_per_level.append(current_strokes)
- current_strokes = 0
-
- # TODO teleport player back
-
-
-func add_stroke():
- current_strokes += 1
-
-
-func revoke_stroke():
- current_strokes -= 1
-