HTML and CSS Reference
In-Depth Information
7. Ater the target building is destroyed, the enemy stops the atack. Add the following
stopAttack method that removes the smoke animaion and resets the variables:
Enemy.prototype.stopAttack = function() {
if (this.isAttacking) {
this.isAttacking = false;
this.attackingTarget = undefined;
this.speed = this.originalSpeed;
8. The enemy will take damage when we create bullets later. We can define a damage
method that takes the damage:
Enemy.prototype.damage = function(damage) {
this.hp -= damage;
The following screenshot shows that the enemy is atacking the satellite; it shows the
atacking smoke as well:
Search WWH ::

Custom Search