//塔类
function Tower(cxt,img,type,x,y,width,height){
this.cxt = cxt;
this.img = img;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
//塔的类型
this.type = type;
//塔的级别
this.level = 1;
//塔的攻击冷却时间
this.cd = 0;
}
Tower.prototype = {
//塔的图片位置
towerMap : [{x:0,y:0},{x:50,y:0},{x:100,y:0},{x:150,y:0},{x:200,y:0}],
//画塔
draw : function(){
Canvas.drawImg(this.cxt,this.img,this.towerMap[this.type].x,this.towerMap[this.type].y,this.width,this.height,this.x,this.y,this.width,this.height);
},
}
var TowerType = [
{
level_1:{
scope:100,buyIt:50,bullet:1,cd:20
},
level_2:{
scope:110,buyIt:50,bullet:1,cd:18
},
level_3:{
scope:120,buyIt:50,bullet:1,cd:15
}
},
{
level_1:{
scope:120,buyIt:75,bullet:1,cd:18
},
level_2:{
scope:130,buyIt:75,bullet:1,cd:15
},
level_3:{
scope:140,buyIt:75,bullet:2,cd:12
}
},
{
level_1:{
scope:140,buyIt:100,bullet:3,cd:18
},
level_2:{
scope:150,buyIt:100,bullet:4,cd:15
},
level_3:{
scope:160,buyIt:100,bullet:5,cd:12
}
},
{
level_1:{
scope:130,buyIt:125,bullet:1,cd:50
},
level_2:{
scope:140,buyIt:125,bullet:1,cd:40
},
level_3:{
scope:150,buyIt:125,bullet:1,cd:30
}
},
{
level_1:{
scope:150,buyIt:150,bullet:1,cd:20
},
level_2:{
scope:160,buyIt:150,bullet:1,cd:15
},
level_3:{
scope:170,buyIt:150,bullet:1,cd:12
}
}
]
//更新塔
function updateTower(){
var tower;
for(var i=0,l=Game.towerList.length;i<l;i++){
tower = Game.towerList[i];
if(!tower)continue;
tower.update(Game.enemyList);
}
}