1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2025-02-04 12:28:35 +00:00

45 lines
1018 B
GDScript3
Raw Normal View History

2021-11-08 07:40:11 -06:00
extends Node
# 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():
ships = []
shipCount = 0
2021-11-08 07:40:11 -06:00
# TODO: What state?
2021-11-08 07:40:11 -06:00
func getState():
pass
# 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
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