HTML and CSS Reference
Objective complete - mini debriefing
There is a 2D array to store the enemy reference so that we can perform a grid-based logic
on the enemies. We check the bullet and enemy collision based on the grid.
In this game design, we allow enemies to stack together into one ile. Because of the
stacking, the 2D array may not contain all the enemy references.
The following screenshot shows two enemy units that are at the same ile. This happened
because we used some buildings to delay the first enemy but didn't kill it. Then, the next
enemy comes and they are stacked together. Although we allow stacking enemies into the
same ile, we do not allow more than one building on each ile.
Each bullet eventually hits only one enemy. At any ime, the enemy's 2D map references
one and only one enemy for each ile. That's a perfect match. So, we loop the bullet list
and check it against the enemy's 2D array.
Note that this process of checking a bullet is true unil we later design a kind of bullet that
explodes and deals with the area under atack. In such cases, the area under atack should
deal with the damage to all the enemies within that bullet's ile. Thus, we will need some
other logic for such an "area-damage" deal.