Hello there,
I'm hitting a wall on this one.
Working on a tower defense game where the towers are the maze.
When i "sell" a tower from the tower's ui (NOT in physic's process) i signal MAIN and
it sells the tower, replace the matching tilemap, queue_free the tower and.... it's supposed to update the path of all the enemies.
My function sell() calls cleartower() which calls updatepath()
Update_path looks like this :
var enemies = get_tree().get_nodes_in_group("enemies")
for child in enemies: #for each of them
var path = $Nav.get_simple_path(child.position, $end_position.position) # we calculate their new path if any.
child.set_path(path)
the problem is that the path won't update,
It will go through but the mobs won't adapt.
I use the same function updatepath for when i place a tower, but from pysicprocess and.. it immediately update all monsters.
func _physics_process(delta):
if update_path == 1:
update_path()
So the only difference is that when i call for updatepath from process it will update. but when i call it from outside of process (ui) it will run updatepath but won't actually work.
Any idea on how to approach this mysterious problem ?
extra info on selling :
I select my already placed tower from my "tower" scene.
Which ui.show() > sell button signal sell(body) to main scene
thanks !