diff --git a/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 new file mode 100644 index 0000000..dd2febb --- /dev/null +++ b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 @@ -0,0 +1,3 @@ +source_md5="aa361943427692c39cd21430895a1f89" +dest_md5="a384b01bb3a48f53f019cb11e44e2019" + diff --git a/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr new file mode 100644 index 0000000..0d5b279 Binary files /dev/null and b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr differ diff --git a/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 new file mode 100644 index 0000000..93ca95d --- /dev/null +++ b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 @@ -0,0 +1,3 @@ +source_md5="4121e74ab010d628490c26ed5391a8f1" +dest_md5="e6145a1ff71559de29a79fa4b0b0fee2" + diff --git a/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr new file mode 100644 index 0000000..e3ddb9a Binary files /dev/null and b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr differ diff --git a/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 new file mode 100644 index 0000000..6f77432 --- /dev/null +++ b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 @@ -0,0 +1,3 @@ +source_md5="d71fa2832e0ad78e94bbd353bc53c2bf" +dest_md5="87d33fdc866cbaaee42f97113a36ceac" + diff --git a/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr new file mode 100644 index 0000000..f3bc471 Binary files /dev/null and b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr differ diff --git a/godot_ship/assets/audio/HitSFX.ogg.import b/godot_ship/assets/audio/HitSFX.ogg.import new file mode 100644 index 0000000..f39b0c1 --- /dev/null +++ b/godot_ship/assets/audio/HitSFX.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr" + +[deps] + +source_file="res://assets/audio/HitSFX.ogg" +dest_files=[ "res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/godot_ship/assets/audio/MissSFX.ogg.import b/godot_ship/assets/audio/MissSFX.ogg.import new file mode 100644 index 0000000..5689c33 --- /dev/null +++ b/godot_ship/assets/audio/MissSFX.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr" + +[deps] + +source_file="res://assets/audio/MissSFX.ogg" +dest_files=[ "res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/godot_ship/assets/audio/SunkSFX.ogg.import b/godot_ship/assets/audio/SunkSFX.ogg.import new file mode 100644 index 0000000..df8f7c6 --- /dev/null +++ b/godot_ship/assets/audio/SunkSFX.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr" + +[deps] + +source_file="res://assets/audio/SunkSFX.ogg" +dest_files=[ "res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/godot_ship/scenes/Game/Game.tscn b/godot_ship/scenes/Game/Game.tscn index 8adf30b..dc384c4 100644 --- a/godot_ship/scenes/Game/Game.tscn +++ b/godot_ship/scenes/Game/Game.tscn @@ -39,4 +39,12 @@ margin_right = 53.0 margin_bottom = 20.0 text = "Forfeit" +[node name="Button" type="Button" parent="."] +margin_left = 593.0 +margin_top = 3.0 +margin_right = 636.0 +margin_bottom = 23.0 +text = "Win" + [connection signal="pressed" from="Buttons/Forfeit" to="." method="_on_Forfeit_pressed"] +[connection signal="button_down" from="Button" to="." method="_on_Button_button_down"] diff --git a/godot_ship/scenes/Game/Victory.tscn b/godot_ship/scenes/Game/Victory.tscn new file mode 100644 index 0000000..1ae4560 --- /dev/null +++ b/godot_ship/scenes/Game/Victory.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://script/game/Victory.gd" type="Script" id=1] +[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 40 +font_data = ExtResource( 2 ) + +[node name="Victory" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="."] +margin_left = 118.32 +margin_top = 44.5109 +margin_right = 260.32 +margin_bottom = 84.5109 +size_flags_vertical = 0 +custom_fonts/font = SubResource( 1 ) +text = "Victory" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="."] +margin_left = 541.0 +margin_top = 327.85 +margin_right = 636.0 +margin_bottom = 353.85 +text = "Exit to Main" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button2" type="Button" parent="."] +margin_left = 2.22023 +margin_top = 337.41 +margin_right = 63.2202 +margin_bottom = 357.41 +text = "Restart" + +[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] +[connection signal="button_down" from="Button2" to="." method="_on_restart_button_down"] diff --git a/godot_ship/script/game/Gameplay/Game.gd b/godot_ship/script/game/Gameplay/Game.gd index 2830d80..3204536 100644 --- a/godot_ship/script/game/Gameplay/Game.gd +++ b/godot_ship/script/game/Gameplay/Game.gd @@ -14,6 +14,8 @@ onready var Fire = preload("res://scenes/Game/Fire.tscn") # Path to Player class, for instantiating new Players in code onready var Player = preload("res://scenes/Game/Player.tscn") +onready var Victory = preload("res://scenes/Game/Victory.tscn") + # Array of instances of the Player class; stores the Players var players # = player1, player2, ... @@ -59,3 +61,10 @@ func _on_Forfeit_pressed(): func end(): queue_free() + + +func _on_Button_button_down(): + AudioBus.emit_signal("button_clicked") + var victory = Victory.instance() + add_child(victory) + victory.connect("exit_main", self, "end") diff --git a/godot_ship/script/game/Setup.gd b/godot_ship/script/game/Setup.gd index f9900b1..4493c9f 100644 --- a/godot_ship/script/game/Setup.gd +++ b/godot_ship/script/game/Setup.gd @@ -4,6 +4,8 @@ signal game_ready onready var Ships = ["2Ship", "3ShipA", "3ShipB", "4Ship", "5Ship"] +onready var Victory = preload("res://scenes/Game/Player.tscn") + class ShipData: var Position: Vector2 var Length: int diff --git a/godot_ship/script/game/Victory.gd b/godot_ship/script/game/Victory.gd new file mode 100644 index 0000000..1e715f5 --- /dev/null +++ b/godot_ship/script/game/Victory.gd @@ -0,0 +1,30 @@ +extends Control + +signal exit_main +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# 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 + + +# returns player(s) back to main menu +func _on_Button_pressed(): + AudioBus.emit_signal("button_clicked") + #MessageBus.emit_signal("change_scene", "Title") + emit_signal("exit_main") + + +func _on_restart_button_down(): + AudioBus.emit_signal("button_clicked") + #MessageBus.emit_signal("change_scene", "Multiplayer") + pass # Replace with function body. +