HTML and CSS Reference
Objective complete - mini debriefing
Each enemy has a child sprite named attackingSmoke . We show it when the enemy is
atacking, and we hide it when it's not.
Designing the movement of the enemy
We take benefit from storing the building data inside a 2D array. While looping through all
the enemies for movement, we can easily know whether there is any building that blocks
When the enemy meets the building, it slows down and stops in front of it.
When the enemy moves very fast, there is chance that the enemy goes through the building
before slowing down fully. This lets the enemy look more realisic.
Enemies stop in front of the buildings. When there exists a building in their current ile
or the next ile, we stop the movement of the enemy. This happens to all the enemies,
so we loop the enemy list and check against the building's 2D map for the collision.
The smoke animaion is a tween-based animaion done in Flash, as shown in the