I have a basic platformer with a player that can move and attack and an enemy that doesn’t do anything. How would I handle attacks by the player? I initially thought I could loop through all the enemies and check if they’re in range for melee or whether the ranged projected is touching the enemy hitbox. I plan on having quite a few enemies on the level at once (5-30), so this seems like ti will be very slow. What are some of the common methods to handle this?
Other information that might help:
I’m using Libgdx with Orthogonal TiledMaps and Box2D + Box2D Lights. The hitboxes are currently defined by a rectangle around the enemy.
Is it better to handle attacks (and player/enemy/map collisions) with Box2D or manually?
Any help will be greatly appreciated