I´m currently trying to add enemys to my game, i guess each of them (3 different enemys) will have their own type since they are going to behave very differently, and as i create these different enemys i add them to a list wich my update and draw funtions process.
What i wonder is how i´m suposed to update all my different enemys, i mean the "eachin" command i´m using in my "for" loop only acesses one type of enemy in the list, do i have to make three "for" loops to update all of them? or is there a better way, and does the same principle apply when i check the collision, i´m i bit worried in that case becuase it´s gonna be alot of loops before everythings checked if i have to divide everything up.
As for the collision at this point i´m first looping through all enemys to see if the player collides with any of them, then i´m looping through every enemy and checks each of them against all active bullets fired by the player (i´m checking the collision maually so to speak with rectangles, not with the imagecollide commands).
I´m also wondering wich loop structure that is best suited for this as well.
Any tips would be very appreciated.
What i wonder is how i´m suposed to update all my different enemys, i mean the "eachin" command i´m using in my "for" loop only acesses one type of enemy in the list, do i have to make three "for" loops to update all of them? or is there a better way, and does the same principle apply when i check the collision, i´m i bit worried in that case becuase it´s gonna be alot of loops before everythings checked if i have to divide everything up.
As for the collision at this point i´m first looping through all enemys to see if the player collides with any of them, then i´m looping through every enemy and checks each of them against all active bullets fired by the player (i´m checking the collision maually so to speak with rectangles, not with the imagecollide commands).
I´m also wondering wich loop structure that is best suited for this as well.
Any tips would be very appreciated.