cooldowns:
attack: stats.move.val
ai:
- path : 1.0 # calculate a path to enemy
- dodge : 1.0 # dodge an incoming bullet
- shootIncoming : 0.5 # shoot down incoming bullet
+ path : 1.00 # calculate a path to enemy
+ dodge : 1.00 # dodge an incoming bullet
+ shootIncoming : 0.25 # shoot down incoming bullet
shootEnemy : 0.75 # shoot at enemy tank if in range
art:
- icon: ''
+ map_icon: ''
inv_icon: ''
types:
player:
tags: [ 'tank' ]
symbol: tanks/thing/player.PlayerTank
stats:
- hp : 10
+ hp : 1
move : 0.90
power : 1
speed : 0.5
shots : 5
- pink:
- name: Pink Tank
- desc: A very pink tank.
+ colors:
+ body : '#E73075'
+ turret : '#A72F5B'
+ barrel : '#2E62C9'
+ blue:
+ name: Blue Tank
+ desc: A friendly blue tank.
+ tags: [ 'tank' ]
+ symbol: tanks/thing/tank.Tank
+ stats:
+ hp : 1
+ move : 0.75
+ power : 1
+ speed : 0.5
+ shots : 3
+ ai:
+ path : 1.0
+ dodge : 1.0
+ shootIncoming : 0.25
+ shootEnemy : 0.75
+ colors:
+ body : '#4596FF'
+ turret : '#182B53'
+ barrel : '#F25522'
+ green:
+ name: Green Tank
+ desc: A very green tank.
tags: [ 'tank' ]
symbol: tanks/thing/tank.Tank
stats:
move : 0.75
power : 1
speed : 0.5
- shots : 4
+ shots : 3
ai:
path : 1.0
dodge : 1.0
- shootIncoming : 0.5
+ shootIncoming : 0.25
shootEnemy : 0.75
+ colors:
+ body : '#83BB32'
+ turret : '#1C625B'
+ barrel : '#D43B24'
+
this );
P =
- game.player = game.addThing(PlayerTank.create('player', 1), 3,9);
- // game.addThing(Tank.create('blue', 1).colors('#4596FF', '#182B53', '#F25522'), 3,9);
+ game.player = game.addThing(PlayerTank.create('player', 1), 5,9);
+ game.addThing(Tank.create('blue', 1), 3,9);
- E1 =
- game.addThing(Tank.create('pink', 2), 0,7);
- E2 =
- game.addThing(Tank.create('pink', 2), 1,0);
- E3 =
- game.addThing(Tank.create('pink', 2), 8,1);
+ E =
+ game.addThing(Tank.create('green', 2), 0,7);
+ game.addThing(Tank.create('green', 2), 1,0);
+ game.addThing(Tank.create('green', 2), 8,1);
- I = game.addThing(Item.create('nitro'), 8,8);
+ I =
+ game.addThing(Item.create('nitro'), 8,8);
},
addWall : function addWall(x,y, w,h, isBoundary){
blocking : map.BLOCKING,
- bodyColor : '#E73075',
- turretColor : '#A72F5B',
- barrelColor : '#2E62C9',
-
// Attributes
stats: {
hp : 1, // health
// TODO: lookup projectile on Bullet
Y.core.descriptors(this, {
- bodyColor : '#83BB32',
- turretColor : '#1C625B',
- barrelColor : '#D43B24',
+ colors : {
+ body : '#83BB32',
+ turret : '#1C625B',
+ barrel : '#D43B24'
+ },
// Bounding box
blocking : map.BLOCKING,
this['init'] =
function initTank(align){
Thing.init.call(this, align);
+ this.colors = Y.extend({}, this.colors);
this.atkGauge = new CooldownGauge(this.cooldowns.attack, this.width+1,this.height+1);
this.onBulletDeath = this.onBulletDeath.bind(this);
};
function render(parent){
if (this.shape) this.shape.remove();
- var w = this.width, w2 = w/2
+ var colors = this.colors
+ , w = this.width, w2 = w/2
, h = this.height, h2 = h/2
, r = w / 4
new Rect(w,h)
.origin(this.originX,this.originY)
.position(this.loc.x, this.loc.y)
- .fill(this.bodyColor)
+ .fill(colors.body)
.appendTo( parent ) ;
if (this.showAttackCooldown)
this.turret =
new Circle(r)
.position(w2, h2)
- .fill(this.turretColor)
+ .fill(colors.turret)
.appendTo( this.shape ) ;
this.barrel =
new Rect(bw,bh)
.position(w2-2, h2-bh/2)
.origin(2, bh/2)
- .fill(this.barrelColor)
+ .fill(colors.barrel)
.appendTo( this.shape ) ;
return this;
};
- this['colors'] =
- function colors(bodyColor, turretColor, barrelColor){
- var names = Y('bodyColor', 'turretColor', 'barrelColor');
-
+ this['tankColors'] =
+ function tankColors(bodyColor, turretColor, barrelColor){
+ var colors = this.colors;
if (arguments.length === 0)
- return names.generate( Y.op.curried.get(this) );
+ return colors;
- if (bodyColor) this.bodyColor = bodyColor;
- if (turretColor) this.turretColor = turretColor;
- if (barrelColor) this.barrelColor = barrelColor;
+ if (bodyColor) colors.body = bodyColor;
+ if (turretColor) colors.turret = turretColor;
+ if (barrelColor) colors.barrel = barrelColor;
return this;
};