From 2fc0a4341dd496f7569d272afd1cd45c6411ab30 Mon Sep 17 00:00:00 2001 From: dsc Date: Wed, 17 Nov 2010 18:59:49 -0800 Subject: [PATCH] Activates attack cooldown. --- src/tanks/thing/thing.js | 3 --- src/tanks/ui/player.js | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) 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 -- 1.7.0.4