I'm creating some rectangles surrounding my sprites for my player and bullet class to detect collisions with the overlaps method in Intersector class of LibGDX.
I have a question:
When I instantiate Player and Bullet, I create a bounding box around the sprite using sprite.getBoundingRectangle() which returns a Rectangle object. I update the movement of these somewhere else in the main class.
When I update the movement of the bullet/player sprite, do I also need to update the position of the bounding box surrounding the bullet/player sprite? Or since the bounding Rectangle surrounds the sprite, will the box automatically move with the sprite?
Thanks
As per
getBoundingRectangle
javadoc:Indeed, if you open
Sprite
source code, you'll see that the bounding rectangle is updated only whengetBoundRectangle
is called.