2021-11-08 07:40:11 -06:00
|
|
|
extends Node
|
|
|
|
|
2021-11-11 14:38:10 -06:00
|
|
|
# Path to Ship class, for instantiating new Ships in code
|
|
|
|
onready var Ship = load("res://script/game/Gameplay/Ship.gd")
|
|
|
|
|
2021-11-08 07:40:11 -06:00
|
|
|
var bottomBoard # Player board
|
|
|
|
var topBoard # Opponent board
|
|
|
|
var ships # list of Ships
|
|
|
|
var shipCount # number of 'active' (un-sunk) ships
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
2021-11-11 14:38:10 -06:00
|
|
|
ships = []
|
|
|
|
shipCount = 0
|
2021-11-08 07:40:11 -06:00
|
|
|
|
2021-11-11 14:38:10 -06:00
|
|
|
# TODO: What state?
|
2021-11-08 07:40:11 -06:00
|
|
|
func getState():
|
|
|
|
pass
|
|
|
|
|
2021-11-11 14:38:10 -06:00
|
|
|
# Place a ship on the board at board-space coordinates
|
|
|
|
func placeShip(in_position, in_size, in_orientation):
|
|
|
|
ships.append(Ship.new(in_position, in_size, in_orientation))
|
2021-11-08 07:40:11 -06:00
|
|
|
pass
|
|
|
|
|
|
|
|
func getBottomBoard():
|
|
|
|
pass
|
|
|
|
|
|
|
|
func getShipCount():
|
|
|
|
pass
|
2021-11-11 14:38:10 -06:00
|
|
|
|
|
|
|
func _init():
|
|
|
|
for i in range(10):
|
|
|
|
bottomBoard.append([])
|
|
|
|
for _i in range(0, 10):
|
|
|
|
bottomBoard[i].resize(10)
|
|
|
|
for i in range(10):
|
|
|
|
topBoard.append([])
|
|
|
|
for _i in range(0, 10):
|
|
|
|
bottomBoard[i].resize(10)
|
|
|
|
|
|
|
|
func worldspace_to_boardspace(coordinate:Vector2):
|
|
|
|
coordinate -= Vector2(36, 36)
|
|
|
|
coordinate /= Vector2(32,32)
|
|
|
|
return coordinate
|