Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GreenTreeStudios-2.5 |
Hello, I am attempting to add multiple of the same child depending on the player’s location away from the previously spawned child
var hittingObstacle = false
var hitFossil = false
var playerDigLoc
var HoleSpawnLocation = preload("res://Characters/Hole/hole_spawner.tscn")
var hole_node = HoleSpawnLocation
func _ready():
playerDigLoc = get_parent().get_node("Player/HoleLocation")
@warning_ignore("unused_parameter")
func _process(delta):
if Input.is_action_pressed("ui_accept") and !hittingObstacle and !hitFossil:
add_child(hole_node.instantiate())
global_position = playerDigLoc.global_position # I believe that this is what is causing part of the problem, for every time I press the action button, it just takes the previously spawned child to the current location of the spawning area.
await get_tree().create_timer(4.0).timeout
if anybody can help me find a solution to this problem, I’ll be grateful. Thank you all in advance.