mirror of
https://github.com/JohnBreaux/Boat-Battle.git
synced 2024-11-15 05:25:57 +00:00
Added victory screen
Added a victory screen. Since there is no current way to win, there is a 'win' button added to the top left of the game screen. Once clicked, victory text will appear and the player will be given the option to return to the main menu.
This commit is contained in:
parent
8905f86be7
commit
b69cc01be2
@ -0,0 +1,3 @@
|
||||
source_md5="aa361943427692c39cd21430895a1f89"
|
||||
dest_md5="a384b01bb3a48f53f019cb11e44e2019"
|
||||
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="4121e74ab010d628490c26ed5391a8f1"
|
||||
dest_md5="e6145a1ff71559de29a79fa4b0b0fee2"
|
||||
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
|
||||
dest_md5="87d33fdc866cbaaee42f97113a36ceac"
|
||||
|
Binary file not shown.
15
godot_ship/assets/audio/HitSFX.ogg.import
Normal file
15
godot_ship/assets/audio/HitSFX.ogg.import
Normal file
@ -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
|
15
godot_ship/assets/audio/MissSFX.ogg.import
Normal file
15
godot_ship/assets/audio/MissSFX.ogg.import
Normal file
@ -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
|
15
godot_ship/assets/audio/SunkSFX.ogg.import
Normal file
15
godot_ship/assets/audio/SunkSFX.ogg.import
Normal file
@ -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
|
@ -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"]
|
||||
|
50
godot_ship/scenes/Game/Victory.tscn
Normal file
50
godot_ship/scenes/Game/Victory.tscn
Normal file
@ -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"]
|
@ -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")
|
||||
|
@ -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
|
||||
|
30
godot_ship/script/game/Victory.gd
Normal file
30
godot_ship/script/game/Victory.gd
Normal file
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user