I am making a game in which there are multiple enemies (up to at least 3 at a time). I create the enemies using a table and I can detect collision with the main character already. Here is the issue:
Each enemy type has a different ID associated with it with different effects. When there are multiple enemies on the screen at a time and one collides with the main character, then the IDs for the enemies get switched and the wrong effect occurs. Any ideas as to why?
In the code, first I create the enemy then add it into the table. Then I check for collisions in a different function using a for loop.