I am developing a 2D space game for mobile devices, but it gets realy complex and my solution is realy confusing and produces lots of repeated code segments.
I hava a world class in which i have multible lists of different object like:
List<Enemy> enemys; List<Projectile> projectiles; List<Collectable> collectables; List<Asteroid> asteroids; List<Effect> effects; ..
Each list gets updated by the world class. but thats not all.. Each enemy has a list of engines, and list of weaponlunchers which gets updated by the enemy. Now each engine adds some fire effects to the world list 'effects', and each weaponluncher adds projectiles to the world list 'projectiles'. All these classes have different parameter, so i need an extra update AND extra render function for each class.
At least they are all childs of 'GameObject' which provides them basic things like position, velocity and acceleration vectors, bounding Polygons and functions like applyForce and a finite state machine
Is there a better or more common way to do this? like one catch-all class which contains all possible parameters and methods for all different objects. (i think this would produce even more confusing code)