2021-10-21 02:21:15 +00:00
|
|
|
extends Control
|
|
|
|
|
2021-11-12 09:01:23 +00:00
|
|
|
onready var Ships = ["2Ship", "3ShipA", "3ShipB", "4Ship", "5Ship"]
|
|
|
|
|
2021-10-21 02:21:15 +00:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
2021-10-21 10:22:42 +00:00
|
|
|
if find_next_valid_focus(): find_next_valid_focus().grab_focus()
|
2021-10-21 02:21:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Forfeit_pressed():
|
2021-11-08 02:53:08 +00:00
|
|
|
AudioBus.emit_signal("button_clicked")
|
2021-10-21 02:26:33 +00:00
|
|
|
queue_free();
|
2021-10-21 06:24:27 +00:00
|
|
|
MessageBus.emit_signal("change_scene", "Title")
|
2021-11-12 02:36:58 +00:00
|
|
|
|
2021-11-12 09:01:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
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.
|