Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | rubendw03 |
So I’m working on this project where dots infect other dots so they turn green. Alse when they touch a red dot they turn green as well. The dots get spawned every couple of seconds. But now I think the problem is that the dots can only get infected by other dots spawned before them.
This is the code wich detects the collision and turns the dots green.
func _on_Human_body_entered(body):
if body.get_name() == "Virus" or body.get_name() == "InfectedHuman":
var mysprite = $HumanSprite
mysprite.set_texture(infected_sprite)
get_node(".").set_name("InfectedHuman")
Is there a way to fix this problem so that dots can be infected by dots spawned after them?