1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-15 05:25:57 +00:00
Boat-Battle/godot_ship/script/game/Gameplay.gd

33 lines
805 B
GDScript

extends Control
onready var Ships = ["2Ship", "3ShipA", "3ShipB", "4Ship", "5Ship"]
# Called when the node enters the scene tree for the first time.
func _ready():
if find_next_valid_focus(): find_next_valid_focus().grab_focus()
func _on_Forfeit_pressed():
AudioBus.emit_signal("button_clicked")
queue_free();
MessageBus.emit_signal("change_scene", "Title")
func _on_Confirm_Placement_pressed():
var valid = true
for ship in Ships:
# validate_placement returns the x-axis distance from the board
# if this is more than zero, the ship is invalid
if get_node(ship).validate_placement():
valid = false
print ("Placement: ", valid)
return valid # Replace with function body.
func _on_Clear_pressed():
for ship in Ships:
get_node(ship).clear()
pass # Replace with function body.