mirror of
https://github.com/JohnBreaux/Boat-Battle.git
synced 2024-11-15 05:25:57 +00:00
Setup: Add variant to ShipData.
This commit is contained in:
parent
83f319b76c
commit
aed672fdd4
@ -13,6 +13,7 @@ class ShipData:
|
|||||||
var Position: Vector2
|
var Position: Vector2
|
||||||
var Length: int
|
var Length: int
|
||||||
var Orientation: bool # (True = vertical) (False = horizontal)
|
var Orientation: bool # (True = vertical) (False = horizontal)
|
||||||
|
var Variant: int = 0
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -41,11 +42,16 @@ func _on_Confirm_Placement_pressed():
|
|||||||
#Saves the location of ships and length of ship into an array
|
#Saves the location of ships and length of ship into an array
|
||||||
var shipLocation = []
|
var shipLocation = []
|
||||||
for ship in Ships:
|
for ship in Ships:
|
||||||
var location = ShipData.new()
|
var shipdata = ShipData.new()
|
||||||
location.Position = get_node(ship).position
|
shipdata.Position = get_node(ship).position
|
||||||
location.Length = get_node(ship).get("ship_length")
|
shipdata.Length = get_node(ship).get("ship_length")
|
||||||
location.Orientation = get_node(ship).get("vertical")
|
shipdata.Orientation = get_node(ship).get("vertical")
|
||||||
shipLocation.append(location)
|
match ship:
|
||||||
|
"3ShipB":
|
||||||
|
shipdata.Variant = 1
|
||||||
|
_:
|
||||||
|
shipdata.Variant = 0
|
||||||
|
shipLocation.append(shipdata)
|
||||||
|
|
||||||
#print out the array for testing
|
#print out the array for testing
|
||||||
for x in shipLocation:
|
for x in shipLocation:
|
||||||
|
Loading…
Reference in New Issue
Block a user