I am creating a simple 2D maze game and I am a little confused about entities & collision detection.
At the moment, my entity class is an abstract class containing position, velocity, sprite and a booolean named shouldRender, as well as a tick and render method. Should I go with this or lean towards a component based entity system? If so, how would I implement that in java?
Also, when I update and render my entities I have a class named Level, which holds an arraylist with all entities. When updating and rendering my entities, I iterate through this list and render the entities that are visible in the camera, via the shouldRender boolean. However, all entities are updated, which makes the FPS drop.
Also, when checking for collisions: should I use a Rectangleand loop through all entities in the list and check if the current entity is colliding with any other entity? Or should I lean more towards stuff like quadtrees etc? (And how would I implement those?)
Because when every entity has to check for collisions with all other entities on the map the game runs at 10-20FPS, which is not too good.
So, if anyone could explain this to me, I would be very thankful!