|Topic was automatically imported from the old Question2Answer platform.
I have 2 different enemies in my test game. One is quite similar to the other, so its just an instance of the other enemy with some exported variables that I’ve changed. One of these exported variables is the bounding box size around my enemy, which I created so I can give my enemy random movement while making sure it only stays within a certain range. The bounding box size will change the size of a collisionShape2D I have connected to an area2D so it can tell me when the enemy has left the bounding box so it can begin moving back inside it. The problem that arises is that even though I’m giving the CollisionShape2D different values for the two enemies, all enemies end up with the same size bounding box, that being the last loaded enemies bounding box size. I’ve looked for a while trying to find a fix for this but I haven’t gotten any luck. Can anybody help me out?
My code to set the bounding box essentially looks like this:
export var bBoxSize : Vector2
get_parent().get_node("BoundBox/CollisionShape2D").shape.extents = bBoxSize