HTML and CSS Reference
In-Depth Information
game.Enemy.call(this);
this.addChild(new lib.Enemy1);
this.originalSpeed = 0.3;
this.deceleration = 0.002;
this.hp = 1;
this.speed = this.originalSpeed;
}
EnemyDummy.prototype = Object.create(game.Enemy.prototype);
game.EnemyDummy = EnemyDummy;
}).call(this, game, createjs, lib);
3. In contrast, the following Boss enemy is a tougher enemy that atacks faster
than usual and comes with more HPs. Alternaively, we can design many types
of enemies, but we will show only two examples here:
;(function(game, cjs, lib){
function Boss(){
game.Enemy.call(this);
this.addChild(new lib.Boss);
this.originalSpeed = 0.2;
this.deceleration = 0.002;
this.hp = 300;
this.attackSpeed = 50;
this.speed = this.originalSpeed;
}
Boss.prototype = Object.create(game.Enemy.prototype);
game.Boss = Boss;
}).call(this, game, createjs, lib);
4. Let's move to the board.js file. We define a 2D array and a list in the Board
constructor funcion and use these to keep track of the reference of the
summoned enemies:
this.enemyMap = game.helper.create2DArray(this.cols, this.rows);
this.enemyList = [];
 
Search WWH ::




Custom Search