1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-25 17:24:19 +00:00

Spawn CropTiles inside their container

This commit is contained in:
Steffo 2023-01-08 13:08:15 +01:00
parent 04be345aba
commit 076fdb62c5
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -6,6 +6,8 @@ var last_fired := 0
var remaining := 10 var remaining := 10
@onready var ray = $RayCast3D @onready var ray = $RayCast3D
# FIXME: use singleton class here as well
@onready var croptiles_container: Node3D = get_tree().root.find_child("CropTiles", true, false)
var croptile = preload("res://island/CropTile.tscn") var croptile = preload("res://island/CropTile.tscn")
@ -60,7 +62,7 @@ func try_placing_seed(ray: RayCast3D) -> bool:
var correct_point = point.floor() var correct_point = point.floor()
var crop = croptile.instantiate() as CropTile var crop = croptile.instantiate() as CropTile
crop.position = correct_point crop.position = correct_point
crop.debug_growth = true croptiles_container.add_child(crop)
get_tree().root.add_child(crop) crop.plant()
return true return true