0 votes

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 
func _ready():
    get_parent().get_node("BoundBox/CollisionShape2D").shape.extents = bBoxSize
Godot version 3.2.3 stable
in Engine by (12 points)

1 Answer

0 votes
by (226 points)

works, thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.