1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00
This commit is contained in:
tommy-l-ngo 2021-10-31 20:23:58 -05:00
commit 448f3a0262
5 changed files with 91 additions and 28 deletions

View File

@ -0,0 +1,41 @@
[preset.0]
name="Windows Desktop x64"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../godot_ship.exe"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/icon=""
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""

View File

@ -1,10 +1,7 @@
extends Control
var debug_output
var debug_line = 0
var debug_canvas
var debug_transform
var debug_active = false
var menu_position = 0.0
@ -19,22 +16,24 @@ var helptext = {
"command_help": [" [command]", "Print information about command.\n" ],
"command_history": ["", "Print the history log.\n" ],
"command_perf": [" stat", "Print performance info (fps, nodes, proctime, ... )\n" ],
"command_list": [" [path]", "List children of path, or of present working node.\n" ],
"command_start": [" filename", "Load PackedScene filename.tscn as child.\n" ],
"command_kill": [" name", "Kill child node with matching name.\n" ],
"command_pwd": ["", "Print the Present Working Node.\n" ],
"command_cd": [" path", "Change the Present Working Node to path.\n" ],
"command_print": [" string", "Print string to the in-game debug console.\n" ],
"command_clear": ["", "Clear the debug output.\n" ],
"command_emit": [" signal [message]", "Emit a message on MessageBus.signal without validation.\n"],
"command_call": [" func [args ...]", "Call func(...) with arguments args.\n" ],
"command_restart": ["", "Kill the current scene tree and plant a new Root.\n" ],
"command_exit": ["", "Quits the program.\n" ],
"command_empty": ["", "No Operation.\n" ],
}
# List of debug commands accessed by alias
@ -44,23 +43,25 @@ var commands = {
["help", "h"]: "command_help",
["hist", "history"]: "command_history",
["perf", "performance"]: "command_perf",
["list", "ls", "l"]: "command_list",
["start", "open", "o"]: "command_start",
["kill", "stop", "k"]: "command_kill",
["pwd", "pwn"]: "command_pwd",
["cd", "cn"]: "command_cd",
["print", "p"]: "command_print",
["clear","cls"]: "command_clear",
["emit", "e"]: "command_emit",
["call", "func"]: "command_call",
["restart", "killall"]: "command_restart",
["exit", "quit"]: "command_exit",
}
[""]: "command_empty"
}
onready var present_working_node = get_node("/root/Main")
@ -84,8 +85,6 @@ signal history_event(text)
# returns: void
func _ready():
debug_canvas = get_node("debug_canvas")
debug_transform = debug_canvas.get_transform()
debug_output = get_node("debug_canvas/VBoxContainer/TextEdit")
command_help([""])
debug_print_line("> ")
@ -129,7 +128,8 @@ func _input(event):
# params: line: Line of text entered by user
# returns: void
func _on_LineEdit_text_entered(line):
history_append(line)
if line != "":
history_append(line)
emit_signal("clear_in")
debug_print_line(line + "\n")
var command = line.split(' ', true, 1)
@ -147,6 +147,7 @@ func _on_LineEdit_text_entered(line):
func history_append(text):
history.resize(history_pos + 2)
history[history_pos] = text
history[history_pos + 1] = ""
history_pos += 1
# history_move: Traverse the history and update the user input box
@ -220,7 +221,7 @@ func command_start (command):
if command.size() > 1:
var pack = load("res://scenes/" + command[1] + ".tscn");
present_working_node.add_child(pack.instance());
debug_print_line("start '" + command[1] + "'\n")
debug_print_line("started '" + command[1] + "'\n")
else:
debug_print_line(get_usage(command[0]))
@ -333,8 +334,8 @@ func command_call(command):
debug_print_line("We're sorry, but your call could not be completed as dialed.\n"
+ "Please hang up and try your call again.\n")
return
if (call_ret):
debug_print_line("'" + String(call_ret) + "'\n")
if (call_ret != null):
debug_print_line(String(call_ret) + "\n")
else:
debug_print_line("null\n")
else:
@ -347,7 +348,7 @@ func command_history(_command):
if line:
debug_print_line(String(lnum) + ": " + line + "\n")
lnum += 1
debug_print_line("history_pos = " + String(history_pos) + "\n")
#debug_print_line("history_pos = " + String(history_pos) + "\n")
# perf: Print the value of a Godot Engine performance counter
func command_perf(command):
@ -375,3 +376,7 @@ func perf(attribute):
"resources":
return Performance.get_monitor(Performance.OBJECT_RESOURCE_COUNT)
return ""
# empty: No command
func command_empty(_command):
pass

View File

@ -42,7 +42,7 @@ func _process(_delta):
# Creates a new instance of each menu scene
func _on_scene_start(scene):
print ("_on_scene_start(",scene,")")
#print ("_on_scene_start(",scene,")")
match scene:
"Singleplayer":
add_child (gameplay.instance())

View File

@ -7,27 +7,27 @@ onready var theme_buttons = find_node("Buttons", true, true).get_children()
# Called when the node enters the scene tree for the first time.
func _ready():
OptionsController.load_options()
find_next_valid_focus().grab_focus()
sound_slider.value = OptionsController.get_sfx_volume()
music_slider.value = OptionsController.get_mus_volume()
func _on_Button_pressed():
queue_free()
# MessageBus.emit_signal("change_scene", "Title")
func _on_SFX_Slider_value_changed(value):
OptionsController.set_sfx_vol(value)
OptionsController.save_options()
func _on_Volume_Slider_value_changed(value):
OptionsController.set_mus_vol(value)
OptionsController.save_options()
func _on_Light_pressed():
OptionsController.set_theme("light")
OptionsController.save_options()
func _on_Dark_pressed():
OptionsController.set_theme("dark")
OptionsController.save_options()

View File

@ -7,12 +7,14 @@ signal change_mus_volume (volume)
signal change_sfx_volume (volume)
# Option variables
var f = File.new()
var options_file = "user://options.save"
var theme = "dark"
var mus_vol = 100
var sfx_vol = 100
func _ready():
pass
load_options()
# Setters
func set_theme(theme_name):
@ -27,6 +29,21 @@ func set_sfx_vol(volume):
sfx_vol = volume
emit_signal("change_sfx_volume", sfx_vol)
#Option Save File
func save_options():
f.open(options_file, File.WRITE)
f.store_var(theme)
f.store_var(mus_vol)
f.store_var(sfx_vol)
f.close()
func load_options():
if f.file_exists(options_file):
f.open(options_file, File.READ)
theme = f.get_var()
mus_vol = f.get_var()
sfx_vol = f.get_var()
f.close()
# Getters
func get_theme():
return theme