From a7dd5d281f1635de3d370ee527c3101cc85b458a Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 15 Aug 2012 09:02:16 +0200 Subject: [PATCH] don't use div dimensions for shooting --- herzle.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/herzle.js b/herzle.js index 20ec4d1..5fb8f32 100644 --- a/herzle.js +++ b/herzle.js @@ -1,6 +1,6 @@ debug = true; -player_pos = [300, 0]; +player_pos = [300, 500]; enemy_pos = [300, 0]; pewpew = 0; @@ -16,16 +16,13 @@ function onKeyDown(e) { player_pos[0] += 10; } if (e.keyCode == '32') { // space = fire - var playerdiv = document.getElementById("player"); - var pos = playerdiv.getClientRects()[0].left - + playerdiv.getClientRects()[0].width / 2; - shoot(pos); + shoot(player_pos); } } shoots = []; function shoot(pos) { - shoots[shoots.length] = [pos, 500]; + shoots[shoots.length] = [pos[0], pos[1]]; // pewpew = 5; }