html, body { width:100%; height:100%;
- font-family:Geogrotesque,Helvetica; color:#fff; background-color:#3F3F3F; }
-body { font-family:Geogrotesque, Helvetica; font-size:12pt; }
+ font-family:Geogrotesque,Helvetica; font-size:12pt; color:#fff;
+ background-color:#3F3F3F; }
h1 { position:fixed; top:0; right:0; margin:0; padding:0; font-size:3em; color:#000; opacity:0.25; z-index:100; }
h2, h3, h4, h5 { margin:0; margin-bottom:0.5em; }
ul, ol, li { list-style: none ! important; margin:0; padding:0; }
#info .sep { opacity:0.1; background-color:#999; margin:5px 0; height:1px; }
#info .fps-sparkline { width:100%; height:1.5em; margin-top:0.5em; }
-#notes { position:fixed; top:4em; right:1em; color:#BFBFBF; }
+#notes { position:fixed; top:4em; right:1em; color:#BFBFBF; width:300px; }
#notes ul, #notes ol, #notes li { list-style:circle ! important; }
#notes li { margin-left:1em; }
rotate : HALF_PI, // rotation speed (radians/sec)
power : 1, // attack power
- speed : 0.75, // attack cool (sec)
+ speed : 1, // attack cool (sec)
shots : 5 // max projectiles in the air at once
},
}
// Nothing to shoot at? Move toward something
- var t = this.nearLike(10000, 'Y.is(Tank, _) && _.align !== '+this.align).shift();
+ var t = this.nearLike(10000, 'Y.is(Tank, _) && _.align !== '+this.align)
+ .remove(this)
+ .shift();
if (t) {
+ // console.log(this, 'moving toward', t);
this.move(t.loc.x, t.loc.y);
return this;
}
},
rotateBarrel : function rotateBarrel(x,y){
- var bb = this.boundingBox
- , w = this.width, h = this.height
- , x0 = x - bb.x1 - w/2
- , y0 = y - bb.y1 - h/2
- , theta = Math.atan2(y0,x0)
- ;
- this.barrel.rotate(theta);
+ this.barrel.rotate(this.angleTo(x,y));
+ return this;
},
rotateBarrelRelPage : function rotateBarrelRelPage(pageX, pageY){
, theta = Math.atan2(-y,-x)
;
this.barrel.rotate(theta);
+ return this;
}
});
this._cooldowns = Y(cs);
},
+ updateCooldowns : function updateCooldowns(){
+ this._cooldowns.invoke('update', NOW);
+ return this;
+ },
+
/**
* Calculates the location of the bullet-spawning point on this Thing.
*/
getTurretLoc : function getTurretLoc(){ return this.loc; },
+ angleTo : function angleTo(x,y){
+ var bb = this.boundingBox
+ , w = this.width, h = this.height
+ , x0 = x - bb.x1 - w/2
+ , y0 = y - bb.y1 - h/2
+ ;
+ return Math.atan2(y0,x0);
+ },
// *** Gameplay Methods *** //
- updateCooldowns : function updateCooldowns(){
- this._cooldowns.invoke('update', NOW);
- return this;
- },
-
/**
* Determines what the creep should do -- move, attack, etc.
*/
},
move : function move(x,y){
- return this.moveByAngle(Math.atan2(-y,-x));
+ return this.moveByAngle( this.angleTo(x,y) );
},
moveByAngle : function moveByAngle(theta){