mirror of
https://github.com/JohnBreaux/Boat-Battle.git
synced 2024-11-15 05:25:57 +00:00
Merge branch 'game-logic' of https://github.com/StatewideInk/Group12 into game-logic
This commit is contained in:
commit
80d3313516
@ -0,0 +1,3 @@
|
|||||||
|
source_md5="a88d669f1f058a347cc4de2244bac64b"
|
||||||
|
dest_md5="1073062c6e594eff250036d7489d44a7"
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
source_md5="def9518adb67248106449930ecafbf56"
|
||||||
|
dest_md5="b1f6910cd5bbb4c510a140a0147c5476"
|
||||||
|
|
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
source_md5="aa361943427692c39cd21430895a1f89"
|
source_md5="aa361943427692c39cd21430895a1f89"
|
||||||
dest_md5="a384b01bb3a48f53f019cb11e44e2019"
|
dest_md5="71290af628a880e44134b3636fc49535"
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
source_md5="4121e74ab010d628490c26ed5391a8f1"
|
source_md5="4121e74ab010d628490c26ed5391a8f1"
|
||||||
dest_md5="e6145a1ff71559de29a79fa4b0b0fee2"
|
dest_md5="8556f1ced20c3b073ae4fcb8a300e349"
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
|
source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
|
||||||
dest_md5="87d33fdc866cbaaee42f97113a36ceac"
|
dest_md5="e694209bc2af13019893f9a931b65aae"
|
||||||
|
|
||||||
|
Binary file not shown.
@ -11,5 +11,5 @@ dest_files=[ "res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr"
|
|||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
loop=true
|
loop=false
|
||||||
loop_offset=0
|
loop_offset=0
|
||||||
|
@ -11,5 +11,5 @@ dest_files=[ "res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr"
|
|||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
loop=true
|
loop=false
|
||||||
loop_offset=0
|
loop_offset=0
|
||||||
|
@ -11,5 +11,5 @@ dest_files=[ "res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr"
|
|||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
loop=true
|
loop=false
|
||||||
loop_offset=0
|
loop_offset=0
|
||||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="StreamTexture"
|
type="StreamTexture"
|
||||||
path="res://.import/dark.png-1931de55ce8abaebbea8e169cd476889.stex"
|
path="res://.import/Background_Dark.png-f04f9416ce96aca35dfd0f16063b0d5b.stex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/backgrounds/dark.png"
|
source_file="res://assets/backgrounds/Background_Dark.png"
|
||||||
dest_files=[ "res://.import/dark.png-1931de55ce8abaebbea8e169cd476889.stex" ]
|
dest_files=[ "res://.import/Background_Dark.png-f04f9416ce96aca35dfd0f16063b0d5b.stex" ]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
BIN
godot_ship/assets/backgrounds/Background_Light.png
Normal file
BIN
godot_ship/assets/backgrounds/Background_Light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
34
godot_ship/assets/backgrounds/Background_Light.png.import
Normal file
34
godot_ship/assets/backgrounds/Background_Light.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Background_Light.png-3684b7dcc3b1fd645e9fff4401113c01.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/backgrounds/Background_Light.png"
|
||||||
|
dest_files=[ "res://.import/Background_Light.png-3684b7dcc3b1fd645e9fff4401113c01.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=false
|
||||||
|
svg/scale=1.0
|
1252
godot_ship/main.tres
1252
godot_ship/main.tres
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,11 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/audio/BGM - Captain Scurvy.ogg" type="AudioStream" id=1]
|
[ext_resource path="res://assets/audio/BGM - Captain Scurvy.ogg" type="AudioStream" id=1]
|
||||||
[ext_resource path="res://script/audio controller/AudioController.gd" type="Script" id=2]
|
[ext_resource path="res://script/audio controller/AudioController.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://assets/audio/ButtonSFX.ogg" type="AudioStream" id=3]
|
[ext_resource path="res://assets/audio/ButtonSFX.ogg" type="AudioStream" id=3]
|
||||||
|
[ext_resource path="res://assets/audio/HitSFX.ogg" type="AudioStream" id=4]
|
||||||
|
[ext_resource path="res://assets/audio/MissSFX.ogg" type="AudioStream" id=5]
|
||||||
|
[ext_resource path="res://assets/audio/SunkSFX.ogg" type="AudioStream" id=6]
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -20,3 +23,18 @@ bus = "BGM"
|
|||||||
[node name="buttonSFX" type="AudioStreamPlayer" parent="."]
|
[node name="buttonSFX" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource( 3 )
|
stream = ExtResource( 3 )
|
||||||
bus = "SFX"
|
bus = "SFX"
|
||||||
|
|
||||||
|
[node name="shipHitSFX" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 4 )
|
||||||
|
volume_db = -10.0
|
||||||
|
bus = "SFX"
|
||||||
|
|
||||||
|
[node name="shipMissedSFX" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 5 )
|
||||||
|
volume_db = -5.0
|
||||||
|
bus = "SFX"
|
||||||
|
|
||||||
|
[node name="shipSunkSFX" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 6 )
|
||||||
|
volume_db = -10.0
|
||||||
|
bus = "SFX"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://main.tres" type="Theme" id=1]
|
|
||||||
[ext_resource path="res://script/debug/debug_menu.gd" type="Script" id=2]
|
[ext_resource path="res://script/debug/debug_menu.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://script/debug/In.gd" type="Script" id=3]
|
[ext_resource path="res://script/debug/In.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://script/debug/Out.gd" type="Script" id=4]
|
[ext_resource path="res://script/debug/Out.gd" type="Script" id=4]
|
||||||
@ -9,7 +8,7 @@
|
|||||||
[node name="Debug" type="Control"]
|
[node name="Debug" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
theme = ExtResource( 1 )
|
theme = ExtResource( 5 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
@ -51,6 +50,7 @@ focus_neighbour_right = NodePath(".")
|
|||||||
focus_neighbour_bottom = NodePath(".")
|
focus_neighbour_bottom = NodePath(".")
|
||||||
focus_next = NodePath(".")
|
focus_next = NodePath(".")
|
||||||
focus_previous = NodePath(".")
|
focus_previous = NodePath(".")
|
||||||
|
theme = ExtResource( 5 )
|
||||||
max_length = 256
|
max_length = 256
|
||||||
placeholder_text = "By your command."
|
placeholder_text = "By your command."
|
||||||
caret_blink = true
|
caret_blink = true
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/backgrounds/dark.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://script/game/Gameplay/Game.gd" type="Script" id=3]
|
[ext_resource path="res://script/game/Gameplay/Game.gd" type="Script" id=3]
|
||||||
|
|
||||||
[node name="Game" type="Control"]
|
[node name="Game" type="Control"]
|
||||||
@ -12,15 +11,6 @@ __meta__ = {
|
|||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Background" type="Sprite" parent="."]
|
|
||||||
show_behind_parent = true
|
|
||||||
position = Vector2( 321.081, 179.931 )
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
flip_h = true
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Buttons" type="VBoxContainer" parent="."]
|
[node name="Buttons" type="VBoxContainer" parent="."]
|
||||||
anchor_left = 0.912
|
anchor_left = 0.912
|
||||||
anchor_top = 0.932
|
anchor_top = 0.932
|
||||||
@ -39,12 +29,22 @@ margin_right = 53.0
|
|||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
text = "Forfeit"
|
text = "Forfeit"
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="ConfirmationDialog" type="ConfirmationDialog" parent="."]
|
||||||
margin_left = 593.0
|
anchor_left = 0.5
|
||||||
margin_top = 3.0
|
anchor_top = 0.5
|
||||||
margin_right = 636.0
|
anchor_right = 0.5
|
||||||
margin_bottom = 23.0
|
anchor_bottom = 0.5
|
||||||
text = "Win"
|
margin_left = -111.5
|
||||||
|
margin_top = -29.0
|
||||||
|
margin_right = 111.5
|
||||||
|
margin_bottom = 29.0
|
||||||
|
rect_min_size = Vector2( 150, 52.5 )
|
||||||
|
window_title = "Forfeit Confirmation..."
|
||||||
|
dialog_text = "Are you sure you want to forfeit?"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false,
|
||||||
|
"_editor_description_": ""
|
||||||
|
}
|
||||||
|
|
||||||
[connection signal="pressed" from="Buttons/Forfeit" to="." method="_on_Forfeit_pressed"]
|
[connection signal="pressed" from="Buttons/Forfeit" to="." method="_on_Forfeit_pressed"]
|
||||||
[connection signal="button_down" from="Button" to="." method="_on_Button_button_down"]
|
[connection signal="confirmed" from="ConfirmationDialog" to="." method="_on_ConfirmationDialog_confirmed"]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/backgrounds/Background_Dark.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://script/Main.gd" type="Script" id=5]
|
[ext_resource path="res://script/Main.gd" type="Script" id=5]
|
||||||
|
|
||||||
[node name="Main" type="Control"]
|
[node name="Main" type="Control"]
|
||||||
@ -10,3 +11,12 @@ script = ExtResource( 5 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="Background" type="TextureRect" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_lock_": true,
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/backgrounds/dark.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://script/options/Options.gd" type="Script" id=2]
|
[ext_resource path="res://script/options/Options.gd" type="Script" id=2]
|
||||||
|
|
||||||
[node name="Options" type="Control"]
|
[node name="Options" type="Control"]
|
||||||
@ -11,15 +10,6 @@ __meta__ = {
|
|||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Background" type="TextureRect" parent="."]
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_lock_": true,
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="MenuLabel" type="RichTextLabel" parent="."]
|
[node name="MenuLabel" type="RichTextLabel" parent="."]
|
||||||
margin_left = 294.0
|
margin_left = 294.0
|
||||||
margin_top = 68.0
|
margin_top = 68.0
|
||||||
@ -68,10 +58,9 @@ focus_neighbour_top = NodePath("../../../Back")
|
|||||||
focus_neighbour_bottom = NodePath("../../Volume Setting/Volume Slider")
|
focus_neighbour_bottom = NodePath("../../Volume Setting/Volume Slider")
|
||||||
focus_next = NodePath("../../Volume Setting/Volume Slider")
|
focus_next = NodePath("../../Volume Setting/Volume Slider")
|
||||||
focus_previous = NodePath("../../../Back")
|
focus_previous = NodePath("../../../Back")
|
||||||
min_value = -25.0
|
max_value = 1.0
|
||||||
max_value = 0.0
|
step = 0.05
|
||||||
tick_count = 10
|
tick_count = 10
|
||||||
ticks_on_borders = true
|
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
@ -100,10 +89,9 @@ focus_neighbour_top = NodePath("../../SFX Setting/SFX Slider")
|
|||||||
focus_neighbour_bottom = NodePath("../../../Buttons/Dark")
|
focus_neighbour_bottom = NodePath("../../../Buttons/Dark")
|
||||||
focus_next = NodePath("../../../Buttons/Dark")
|
focus_next = NodePath("../../../Buttons/Dark")
|
||||||
focus_previous = NodePath("../../SFX Setting/SFX Slider")
|
focus_previous = NodePath("../../SFX Setting/SFX Slider")
|
||||||
min_value = -50.0
|
max_value = 1.0
|
||||||
max_value = 0.0
|
step = 0.05
|
||||||
tick_count = 10
|
tick_count = 10
|
||||||
ticks_on_borders = true
|
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
@ -127,10 +115,9 @@ margin_left = 64.0
|
|||||||
margin_top = 48.0
|
margin_top = 48.0
|
||||||
margin_right = 208.0
|
margin_right = 208.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
min_value = -50.0
|
max_value = 1.0
|
||||||
max_value = 0.0
|
step = 0.05
|
||||||
tick_count = 10
|
tick_count = 10
|
||||||
ticks_on_borders = true
|
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/backgrounds/dark.png" type="Texture" id=1]
|
|
||||||
[ext_resource path="res://script/title screen/Title Screen.gd" type="Script" id=2]
|
[ext_resource path="res://script/title screen/Title Screen.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=3]
|
[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=3]
|
||||||
|
|
||||||
@ -18,10 +17,6 @@ __meta__ = {
|
|||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Title-Screen-Background" type="Sprite" parent="."]
|
|
||||||
position = Vector2( 320, 180 )
|
|
||||||
texture = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
# Scenes
|
# Scenes
|
||||||
onready var title_screen = preload("res://scenes/Title Screen.tscn")
|
onready var Title_Screen = preload("res://scenes/Title Screen.tscn")
|
||||||
onready var game = preload("res://scenes/Game/Game.tscn" )
|
onready var Game = preload("res://scenes/Game/Game.tscn" )
|
||||||
onready var options = preload("res://scenes/Options.tscn" )
|
onready var Options = preload("res://scenes/Options.tscn" )
|
||||||
onready var debug_menu = preload("res://scenes/Debug Menu.tscn" )
|
onready var Debug_Menu = preload("res://scenes/Debug Menu.tscn" )
|
||||||
|
|
||||||
|
# Themes
|
||||||
|
var lightmode = preload("res://assets/backgrounds/Background_Light.png");
|
||||||
|
var darkmode = preload("res://assets/backgrounds/Background_Dark.png");
|
||||||
|
|
||||||
#flags
|
#flags
|
||||||
var power_saving = true
|
var power_saving = true
|
||||||
@ -21,12 +25,15 @@ func _ready():
|
|||||||
_errno += MessageBus.connect("list_scenes" , self, "_on_scene_list" )
|
_errno += MessageBus.connect("list_scenes" , self, "_on_scene_list" )
|
||||||
_errno += MessageBus.connect("quit" , self, "_on_quit_request" )
|
_errno += MessageBus.connect("quit" , self, "_on_quit_request" )
|
||||||
_errno += MessageBus.connect("return_to_title", self, "_on_title_request" )
|
_errno += MessageBus.connect("return_to_title", self, "_on_title_request" )
|
||||||
|
_errno += OptionsController.connect("change_theme", self, "_on_change_theme" )
|
||||||
|
# Set the theme based on the config file
|
||||||
|
_on_change_theme(OptionsController.get_theme())
|
||||||
# go fullscreen
|
# go fullscreen
|
||||||
OS.low_processor_usage_mode = power_saving
|
OS.low_processor_usage_mode = power_saving
|
||||||
OS.low_processor_usage_mode_sleep_usec = 6800
|
OS.low_processor_usage_mode_sleep_usec = 6800
|
||||||
OS.window_fullscreen = start_fullscreen
|
OS.window_fullscreen = start_fullscreen
|
||||||
if debug_enabled:
|
if debug_enabled:
|
||||||
add_child(debug_menu.instance())
|
add_child(Debug_Menu.instance())
|
||||||
|
|
||||||
# Process global keybinds
|
# Process global keybinds
|
||||||
func _input(event):
|
func _input(event):
|
||||||
@ -38,29 +45,33 @@ func _input(event):
|
|||||||
# Ensure the scene doesn't become empty
|
# Ensure the scene doesn't become empty
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
# Make sure there's something running
|
# Make sure there's something running
|
||||||
|
# Background counts as one child
|
||||||
# Debug counts as one child
|
# Debug counts as one child
|
||||||
if get_child_count() < 1 + int(debug_enabled):
|
if get_child_count() < 2 + int(debug_enabled):
|
||||||
MessageBus.emit_signal("change_scene", "Title")
|
MessageBus.emit_signal("change_scene", "Title")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Creates a new instance of each menu scene
|
# Creates a new instance of each menu scene
|
||||||
func _on_scene_start(scene):
|
func _on_scene_start(scene):
|
||||||
|
var instance
|
||||||
#print ("_on_scene_start(",scene,")")
|
#print ("_on_scene_start(",scene,")")
|
||||||
match scene:
|
match scene:
|
||||||
"Singleplayer":
|
"Singleplayer":
|
||||||
add_child (game.instance())
|
instance = Game.instance()
|
||||||
|
add_child (instance)
|
||||||
return true
|
return true
|
||||||
"Multiplayer":
|
"Multiplayer":
|
||||||
game = game.instance()
|
instance = Game.instance()
|
||||||
game.is_multiplayer = true
|
instance.is_multiplayer = true
|
||||||
add_child (game)
|
add_child (instance)
|
||||||
# add_child (multiplayercontroller.instance())
|
|
||||||
return true
|
return true
|
||||||
"Options":
|
"Options":
|
||||||
add_child (options.instance())
|
instance = Options.instance()
|
||||||
|
add_child (instance)
|
||||||
return true
|
return true
|
||||||
"Title":
|
"Title":
|
||||||
add_child (title_screen.instance())
|
instance = Title_Screen.instance()
|
||||||
|
add_child (instance)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func _on_scene_start_by_name(scene):
|
func _on_scene_start_by_name(scene):
|
||||||
@ -89,3 +100,9 @@ func _on_quit_request():
|
|||||||
# Kills the current tree and replaces it with a new one
|
# Kills the current tree and replaces it with a new one
|
||||||
func _on_title_request():
|
func _on_title_request():
|
||||||
return get_tree().change_scene("res://scenes/Main.tscn")
|
return get_tree().change_scene("res://scenes/Main.tscn")
|
||||||
|
|
||||||
|
func _on_change_theme(theme):
|
||||||
|
if theme == "light":
|
||||||
|
get_node("Background").set_texture(lightmode)
|
||||||
|
elif theme == "dark":
|
||||||
|
get_node("Background").set_texture(darkmode)
|
||||||
|
@ -6,3 +6,6 @@ extends Node
|
|||||||
|
|
||||||
# Ask for a scene change
|
# Ask for a scene change
|
||||||
signal button_clicked
|
signal button_clicked
|
||||||
|
signal ship_hit
|
||||||
|
signal ship_missed
|
||||||
|
signal ship_sunk
|
||||||
|
@ -9,9 +9,22 @@ extends Control
|
|||||||
func _ready():
|
func _ready():
|
||||||
var _errno = 0
|
var _errno = 0
|
||||||
_errno += AudioBus.connect("button_clicked", self, "_button_clicked")
|
_errno += AudioBus.connect("button_clicked", self, "_button_clicked")
|
||||||
|
_errno += AudioBus.connect("ship_hit", self, "_ship_hit")
|
||||||
|
_errno += AudioBus.connect("ship_missed", self, "_ship_missed")
|
||||||
|
_errno += AudioBus.connect("ship_sunk", self, "_ship_sunk")
|
||||||
|
|
||||||
func _button_clicked():
|
func _button_clicked():
|
||||||
$buttonSFX.play()
|
$buttonSFX.play()
|
||||||
|
|
||||||
|
func _ship_hit():
|
||||||
|
$shipHitSFX.play()
|
||||||
|
|
||||||
|
func _ship_missed():
|
||||||
|
$shipMissedSFX.play()
|
||||||
|
|
||||||
|
func _ship_sunk():
|
||||||
|
$shipSunkSFX.play()
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
# pass
|
# pass
|
||||||
|
@ -33,6 +33,9 @@ func _ready():
|
|||||||
var setup = Setup.instance()
|
var setup = Setup.instance()
|
||||||
setup.connect("game_ready", self, "game_setup")
|
setup.connect("game_ready", self, "game_setup")
|
||||||
add_child(setup)
|
add_child(setup)
|
||||||
|
|
||||||
|
get_node("ConfirmationDialog").get_ok().text = "Yes"
|
||||||
|
get_node("ConfirmationDialog").get_cancel().text = "No"
|
||||||
|
|
||||||
# TODO: Move Setup into the Player.
|
# TODO: Move Setup into the Player.
|
||||||
func game_setup(_ships):
|
func game_setup(_ships):
|
||||||
@ -57,14 +60,16 @@ func display_turn():
|
|||||||
|
|
||||||
func _on_Forfeit_pressed():
|
func _on_Forfeit_pressed():
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
end()
|
get_node("ConfirmationDialog").popup()
|
||||||
|
|
||||||
func end():
|
func end():
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
func _on_Button_button_down():
|
func _on_Button_button_down():
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
var victory = Victory.instance()
|
var victory = Victory.instance()
|
||||||
add_child(victory)
|
add_child(victory)
|
||||||
victory.connect("exit_main", self, "end")
|
victory.connect("exit_main", self, "end")
|
||||||
|
|
||||||
|
func _on_ConfirmationDialog_confirmed():
|
||||||
|
end()
|
||||||
|
@ -10,9 +10,9 @@ onready var theme_buttons = find_node("Buttons", true, true).get_children()
|
|||||||
func _ready():
|
func _ready():
|
||||||
OptionsController.load_options()
|
OptionsController.load_options()
|
||||||
find_next_valid_focus().grab_focus()
|
find_next_valid_focus().grab_focus()
|
||||||
master_slider.value = OptionsController.get_mas_volume()
|
master_slider.value = db2linear(OptionsController.get_mas_volume())
|
||||||
music_slider.value = OptionsController.get_mus_volume()
|
music_slider.value = db2linear(OptionsController.get_mus_volume())
|
||||||
sound_slider.value = OptionsController.get_sfx_volume()
|
sound_slider.value = db2linear(OptionsController.get_sfx_volume())
|
||||||
|
|
||||||
func _on_Button_pressed():
|
func _on_Button_pressed():
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
@ -20,14 +20,17 @@ func _on_Button_pressed():
|
|||||||
#MessageBus.emit_signal("change_scene", "Title")
|
#MessageBus.emit_signal("change_scene", "Title")
|
||||||
|
|
||||||
func _on_Master_Slider_value_changed(value):
|
func _on_Master_Slider_value_changed(value):
|
||||||
|
value = linear2db(value)
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
OptionsController.set_vol(value, "mas_vol")
|
OptionsController.set_vol(value, "mas_vol")
|
||||||
|
|
||||||
func _on_Music_Slider_value_changed(value):
|
func _on_Music_Slider_value_changed(value):
|
||||||
|
value = linear2db(value)
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
OptionsController.set_vol(value, "mus_vol")
|
OptionsController.set_vol(value, "mus_vol")
|
||||||
|
|
||||||
func _on_SFX_Slider_value_changed(value):
|
func _on_SFX_Slider_value_changed(value):
|
||||||
|
value = linear2db(value)
|
||||||
AudioBus.emit_signal("button_clicked")
|
AudioBus.emit_signal("button_clicked")
|
||||||
OptionsController.set_vol(value, "sfx_vol")
|
OptionsController.set_vol(value, "sfx_vol")
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ signal change_theme (theme)
|
|||||||
var f = File.new()
|
var f = File.new()
|
||||||
var options_file = "user://options.save"
|
var options_file = "user://options.save"
|
||||||
var theme = "dark"
|
var theme = "dark"
|
||||||
var mas_vol = 0
|
var mas_vol = linear2db(1)
|
||||||
var mus_vol = 0
|
var mus_vol = linear2db(1)
|
||||||
var sfx_vol = 0
|
var sfx_vol = linear2db(1)
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
load_options()
|
load_options()
|
||||||
@ -23,6 +23,7 @@ func set_theme(theme_name):
|
|||||||
save_options()
|
save_options()
|
||||||
emit_signal("change_theme", theme)
|
emit_signal("change_theme", theme)
|
||||||
save_options()
|
save_options()
|
||||||
|
|
||||||
func set_vol(volume, type):
|
func set_vol(volume, type):
|
||||||
if type == "mas_vol":
|
if type == "mas_vol":
|
||||||
mas_vol = volume
|
mas_vol = volume
|
||||||
@ -61,7 +62,7 @@ func load_options():
|
|||||||
mus_vol = f.get_var()
|
mus_vol = f.get_var()
|
||||||
sfx_vol = f.get_var()
|
sfx_vol = f.get_var()
|
||||||
f.close()
|
f.close()
|
||||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mus_vol)
|
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mas_vol)
|
||||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("BGM"), mus_vol)
|
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("BGM"), mus_vol)
|
||||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), sfx_vol)
|
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), sfx_vol)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user