Implemented menu browsing
This commit is contained in:
parent
0a9b3f96d1
commit
2f7cf0ef81
4 changed files with 259 additions and 223 deletions
10
Game/GUI.gd
10
Game/GUI.gd
|
@ -1,24 +1,26 @@
|
|||
extends Control
|
||||
|
||||
@export var filename = "user://settings.save"
|
||||
var settings_filename = "user://settings.save"
|
||||
var settings = {}
|
||||
|
||||
func _ready():
|
||||
if has_settings():
|
||||
load_settings()
|
||||
print(settings)
|
||||
|
||||
func has_settings():
|
||||
return false
|
||||
var filecheck = File.new()
|
||||
return filecheck.file_exists(settings_filename)
|
||||
|
||||
func save_settings():
|
||||
var file = File.new()
|
||||
file.open(filename, File.WRITE)
|
||||
file.open(settings_filename, File.WRITE)
|
||||
file.store_var(settings)
|
||||
file.close()
|
||||
|
||||
func load_settings():
|
||||
var file = File.new()
|
||||
file.open(filename, File.READ)
|
||||
file.open(settings_filename, File.READ)
|
||||
settings = file.get_var()
|
||||
file.close()
|
||||
|
||||
|
|
225
Game/Level.tscn
Normal file
225
Game/Level.tscn
Normal file
File diff suppressed because one or more lines are too long
18
Game/Main.gd
Normal file
18
Game/Main.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
extends Node
|
||||
|
||||
enum Gamemode {IN_MENU, PLAYING}
|
||||
|
||||
var mode = Gamemode.IN_MENU
|
||||
|
||||
func _input(event) -> void:
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
if mode == Gamemode.PLAYING:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
$CanvasLayer/GUI.show()
|
||||
$Level/Player.input_active = false
|
||||
mode = Gamemode.IN_MENU
|
||||
elif mode == Gamemode.IN_MENU:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
$CanvasLayer/GUI.hide()
|
||||
$Level/Player.input_active = true
|
||||
mode = Gamemode.PLAYING
|
229
Game/Main.tscn
229
Game/Main.tscn
File diff suppressed because one or more lines are too long
Reference in a new issue