First of all, hello everyone.
I have already made some super-basic 2D games like TicTacToe, snake and pong. I think I am starting to understand how simple games work. Collision detection in pong is simple, because there is only one ball and 2 objects that it can hit. But when I think about some simple 2D shooter game i feel confused.. Let's say I have my character, some enemies and some platforms, on which I can jump.. How am I supposed to check the collision of every object ( me, all bullets flying, all enemies and all platforms ). When I have 1 enemy and many bullets I can store the bullets in the array and then use loop to check the collision between the enemy and every element of the array. When I have many enemies and many bullets I can use double loop.. this is the way I see it, I have no idea if it is correct. But what if I have many elements of different types? Enemies, trees, fences, cars etc.. This topic really confuses me.. I hope everything is clear.
Second question, programming side:
In my poorly written code I am mostly using numbers instead of const variables..
// this is my code
enemy array[10];
// this is the experienced programmers code
const int MAX_ENEMIES=10;
enemy array[MAX_ENEMIES];
what is the point of doing it?