diff options
author | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-16 23:32:01 +0200 |
---|---|---|
committer | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-16 23:32:01 +0200 |
commit | 373b0d66678a349d39146262d5b288b39c5cb1e1 (patch) | |
tree | 0c8d9aa28450e8b94e014833a94a895fde3258e5 /godot/scripts | |
parent | 9a750a6688ad923d990d11dc464f783210b50678 (diff) | |
download | 2022-373b0d66678a349d39146262d5b288b39c5cb1e1.tar.gz 2022-373b0d66678a349d39146262d5b288b39c5cb1e1.tar.bz2 2022-373b0d66678a349d39146262d5b288b39c5cb1e1.zip |
goal zone
the rest is trash
Diffstat (limited to '')
-rw-r--r-- | godot/scripts/GoalTriggerBox.gd | 2 | ||||
-rw-r--r-- | godot/scripts/LevelLoader.gd | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/godot/scripts/GoalTriggerBox.gd b/godot/scripts/GoalTriggerBox.gd index 9281f0f..17e98ad 100644 --- a/godot/scripts/GoalTriggerBox.gd +++ b/godot/scripts/GoalTriggerBox.gd @@ -5,7 +5,7 @@ var loader: Loader = null # Called when the node enters the scene tree for the first time. func _ready(): - loader = get_node("../LevelLoader") + loader = get_node("/root/Game/LevelLoader") # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/godot/scripts/LevelLoader.gd b/godot/scripts/LevelLoader.gd index 538d4ef..2aec587 100644 --- a/godot/scripts/LevelLoader.gd +++ b/godot/scripts/LevelLoader.gd @@ -2,15 +2,26 @@ 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. @@ -25,6 +36,20 @@ func load_next_level(): # TODO load main menu return - # TODO teleport the die to the start point + # 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 + |