game.player = game.addThing(new PlayerTank(1), 3,9);
// game.addThing(new Tank(1).colors('#4596FF', '#182B53', '#F25522'), 3,9);
- // E =
- // game.addThing(new Tank(2), 0,7);
- // game.addThing(new Tank(2), 1,0);
- // game.addThing(new Tank(2), 8,1);
+ E =
+ game.addThing(new Tank(2), 0,7);
+ game.addThing(new Tank(2), 1,0);
+ game.addThing(new Tank(2), 8,1);
- // I = game.addThing(new Item(), 8,8);
+ I = game.addThing(new Item(), 8,8);
- DATA = $('<pre id="data" style="position:absolute;top:0;left:0;width:200px;"></pre>').appendTo('body');
- E = game.addThing(new Thing(2), 0,0);
- var i = 0;
- function testBulletSpeed(){
- B = P.shoot(0,475);
- var start = new Date().getTime()
- , startClock = NOW
- , startX = B.loc.x;
- B.bounces = 1;
- console.log(i+' B.movePerMs='+B.movePerMs+', move='+B.stats.move);
-
- B.addEventListener('destroy', function(evt){
- var elapsed = (new Date().getTime() - start)/1000
- , clock = (NOW - startClock)/1000
- , distance = startX - B.loc.x ;
- DATA.text(DATA.text()+elapsed.toFixed(3)+'\t'+clock.toFixed(3)+'\t'+distance.toFixed(3)+'\t'+(distance/elapsed).toFixed(3)+'\n');
- if (++i < 20) testBulletSpeed();
- });
- }
- game.addEventListener('start', function(evt){
- DATA.text('elapsed\tclock\tpx\tpx/s\n');
- testBulletSpeed();
- });
+ // DATA = $('<pre id="data" style="position:absolute;top:0;left:0;width:200px;"></pre>').appendTo('body');
+ // E = game.addThing(new Thing(2), 0,0);
+ // var i = 0;
+ // function testBulletSpeed(){
+ // B = P.shoot(0,475);
+ // var start = new Date().getTime()
+ // , startClock = NOW
+ // , startX = B.loc.x;
+ // B.bounces = 1;
+ // console.log(i+' B.movePerMs='+B.movePerMs+', move='+B.stats.move);
+ //
+ // B.addEventListener('destroy', function(evt){
+ // var elapsed = (new Date().getTime() - start)/1000
+ // , clock = (NOW - startClock)/1000
+ // , distance = startX - B.loc.x ;
+ // DATA.text(DATA.text()+elapsed.toFixed(3)+'\t'+clock.toFixed(3)+'\t'+distance.toFixed(3)+'\t'+(distance/elapsed).toFixed(3)+'\n');
+ // if (++i < 20) testBulletSpeed();
+ // });
+ // }
+ // game.addEventListener('start', function(evt){
+ // DATA.text('elapsed\tclock\tpx\tpx/s\n');
+ // testBulletSpeed();
+ // });
},
addWall : function addWall(x,y, w,h, isBoundary){
, config = require('tanks/config').config
, updateTimer = null
+, LBT = null
;
function stopProp(evt){ evt.stopPropagation(); }
// $('#overlay').hide();
}
-function gameExists(){ return !!tanks.currentGame; }
+function gameExists(){ return !!tanks.game; }
function setupGame(){
if ( gameExists() ) teardownGame();
- LBT = tanks.currentGame = new Game();
+ LBT = tanks.game = new Game();
LBT.addEventListener('win', gameover('You Win!', 'Play Again', ''));
LBT.addEventListener('lose', gameover('You Lose :(', 'Try Again', ''));
}
function pauseGame(evt){
- // $('#overlay').toggle();
+ $('#overlay').toggle();
$('#pause').toggle();
toggleGame();
}