From: dsc Date: Thu, 18 Nov 2010 02:59:49 +0000 (-0800) Subject: Activates attack cooldown. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=2fc0a4341dd496f7569d272afd1cd45c6411ab30;p=tanks.git Activates attack cooldown. --- diff --git a/src/tanks/thing/thing.js b/src/tanks/thing/thing.js index 20eb553..776d64d 100644 --- a/src/tanks/thing/thing.js +++ b/src/tanks/thing/thing.js @@ -128,9 +128,6 @@ Thing = new Evt.Class('Thing', { else this.move(); - if (bb.x1 <= MIN_X_DIST || bb.x2 >= MAX_X_DIST) - this.destroy(); - return this; }, diff --git a/src/tanks/ui/player.js b/src/tanks/ui/player.js index 3f90adf..7d011a7 100644 --- a/src/tanks/ui/player.js +++ b/src/tanks/ui/player.js @@ -57,6 +57,8 @@ Player = new Y.Class('Player', { if (this.tank.dead) return this.tank; + this.tank.cooldowns.invoke('update', NOW); + var action = this.queue.shift(); if (action && action.type === 'fire') { @@ -70,9 +72,14 @@ Player = new Y.Class('Player', { fire : function fire(){ var WIGGLE = 4 + , tank = this.tank + , cooldown = tank.cooldowns.attr('attack') + ; + + if ( !cooldown.activate(NOW) ) + return; - , tank = this.tank - , barrel = tank.barrel + var barrel = tank.barrel , bb = tank.boundingBox , w2 = bb.width/2, h2 = bb.height/2 , x0 = bb.x1+w2, y0 = bb.y1+h2