did a lot of stuff holy shit
This commit is contained in:
26
scripts/autoloads/level_manager.gd
Normal file
26
scripts/autoloads/level_manager.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
|
||||
@onready var transition: CanvasLayer = $Transition
|
||||
|
||||
@export var levels: Array[PackedScene]
|
||||
var level_pointer: int = 0
|
||||
|
||||
const PROGRESS_SAVE_PATH: String = "user://save.cfg"
|
||||
var progress_save: ConfigFile = ConfigFile.new()
|
||||
|
||||
func _ready() -> void:
|
||||
progress_save.load(PROGRESS_SAVE_PATH)
|
||||
|
||||
func next_level() -> void:
|
||||
level_pointer += 1
|
||||
if level_pointer < levels.size():
|
||||
transition.show()
|
||||
await get_tree().create_timer(1).timeout
|
||||
get_tree().change_scene_to_packed(levels[level_pointer])
|
||||
await get_tree().create_timer(2).timeout
|
||||
transition.hide()
|
||||
else:
|
||||
get_tree().change_scene_to_file("res://scenes/gui/menus/game_finished.tscn")
|
||||
|
||||
func start_last_level() -> void:
|
||||
pass
|
@@ -7,14 +7,14 @@ var fullscreen: bool
|
||||
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
close_request_window = preload("res://scenes/close_game_confirmation.tscn").instantiate()
|
||||
close_request_window = preload("res://scenes/gui/menus/close_game_confirmation.tscn").instantiate()
|
||||
add_child(close_request_window)
|
||||
pause_menu = preload("res://scenes/gui/menus/pause_menu.tscn").instantiate()
|
||||
add_child(pause_menu)
|
||||
|
||||
fullscreen = DisplayServer.window_get_mode() == 4
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_released("fullscreen"):
|
||||
fullscreen = !fullscreen
|
||||
toggle_fullscreen()
|
||||
|
@@ -8,3 +8,7 @@ func _on_main_menu_pressed() -> void:
|
||||
hide()
|
||||
WindowManager.pause_menu.hide()
|
||||
get_tree().change_scene_to_file("res://scenes/gui/menus/main_menu.tscn")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
hide()
|
||||
|
7
scripts/game_over.gd
Normal file
7
scripts/game_over.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends CanvasLayer
|
||||
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
get_tree().paused = false
|
||||
get_tree().reload_current_scene()
|
5
scripts/level_finish_area.gd
Normal file
5
scripts/level_finish_area.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Area3D
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if body is Player:
|
||||
LevelManager.next_level()
|
7
scripts/menus/game_finished.gd
Normal file
7
scripts/menus/game_finished.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends Control
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/gui/menus/main_menu.tscn")
|
@@ -1,11 +1 @@
|
||||
extends PanelContainer
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
@@ -3,6 +3,7 @@ class_name MainMenu
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
LevelManager.level_pointer = 0
|
||||
|
||||
func _on_start_game_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/levels/lvl_1.tscn")
|
||||
|
@@ -28,6 +28,10 @@ func _ready() -> void:
|
||||
WindowManager.pause_menu.continued.connect(capture)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if position.y < -33:
|
||||
$GameOver.show()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
get_tree().paused = true
|
||||
gun_cam.transform = camera.transform
|
||||
|
||||
if not is_on_floor():
|
||||
|
Reference in New Issue
Block a user