I am currently building a game, where u have controllers which you can move around and are connected one to another by lines, and the lines need to collide with all the eggs on the screen to go to the next level. Also, whenever an egg collides with a line, the egg changes its colour.
The thing is, I have about 10 eggs and 7 lines, and getting the conditionals for checking if the egg is touched by a line, and if all the eggs are touched by lines, is A LOT (I mean seriously a lot I’ve already tried it) of code.
Its just stacking HUNDREDS of conditionals and event listeners together.
Does anybody have a prettier solution?
Thnx for any comments 😀
You could use nested for loops to check on enterframe event. This could eat up the processor, so make sure you only run the loop when necessary.
Here is a simple example of the nested loop: