Update Level 1.tscn, Level 2.tscn, Level 3.tscn, and 9 more files

This commit is contained in:
Clevertop 2024-08-13 02:32:14 +10:00
parent f470efbe1f
commit 89cfa2882a
12 changed files with 204 additions and 112 deletions

View file

@ -7,7 +7,7 @@ signal tick(time : int)
@export_group("Variables")
@export var level_tick : float = 1 # how often to run a command
@export var level_time : float = 10 # the amoutn of time allowed for the level
@export var level_name : String = "Level X\nTest Room"
@export_multiline var level_name : String = "Level X\nTest Room"
#reset these
var tick_timer : float = 0
@ -172,6 +172,4 @@ func _on_player_object_clicked(object):
start_room()
func _on_area_3d_body_entered(body):
if body.name == "Player":
GameManager.load_next_level()

16
Scripts/end_zone.gd Normal file
View file

@ -0,0 +1,16 @@
extends MeshInstance3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_area_3d_body_entered(body):
if body.name == "Player":
GameManager.load_next_level()

View file

@ -9,6 +9,7 @@ var credits_shown : bool = false
# Called when the node enters the scene tree for the first time.
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
for level_num in GameManager.levels.size():
var new_button : Button = Button.new()
new_button.text = "Level " + str(level_num) + " : " + GameManager.levels[level_num].level_name
@ -31,9 +32,10 @@ func _process(delta):
func pick_level(picked_level:String):
for level in GameManager.levels:
if level.level_name == picked_level:
get_tree().change_scene_to_file(level.level_path)
for level_num in GameManager.levels.size():
if GameManager.levels[level_num].level_name == picked_level:
get_tree().change_scene_to_file(GameManager.levels[level_num].level_path)
GameManager.current_level = level_num
func _on_credits_button_pressed():
credits_shown = !credits_shown