From 085763c88b50f8131dd587d8807e30e9e8c466a4 Mon Sep 17 00:00:00 2001 From: neingeist Date: Tue, 14 Aug 2012 23:20:12 +0200 Subject: [PATCH] rotate --- herzle.html | 8 ++++---- herzle.js | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/herzle.html b/herzle.html index d3350ef..9a58cf5 100644 --- a/herzle.html +++ b/herzle.html @@ -12,14 +12,14 @@ #player { position: absolute; bottom: 10%; - /* -webkit-transform: rotate(90deg); - -moz-transform: rotate(90deg); */ + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); } #enemy { position: absolute; top: 10%; - /* -webkit-transform: rotate(90deg); - -moz-transform: rotate(90deg); */ + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); border-style: solid; border-width: 1px; } #pewpew { diff --git a/herzle.js b/herzle.js index 92f809a..0566b17 100644 --- a/herzle.js +++ b/herzle.js @@ -27,15 +27,15 @@ function shoot(player_pos) { } function isCollided(a, b) { - var a_left = parseInt(a.style.left); - var a_right = a_left + a.offsetWidth; - var a_top = parseInt(a.style.top); - var a_bottom = a_top + a.offsetHeight; - - var b_left = parseInt(b.style.left); - var b_right = b_left + b.offsetWidth; - var b_top = parseInt(b.style.top); - var b_bottom = b_top + b.offsetHeight; + var a_left = a.getClientRects()[0].left; + var a_right = a.getClientRects()[0].right; + var a_top = a.getClientRects()[0].top; + var a_bottom = a.getClientRects()[0].bottom; + + var b_left = b.getClientRects()[0].left; + var b_right = b.getClientRects()[0].right; + var b_top = b.getClientRects()[0].top; + var b_bottom = b.getClientRects()[0].bottom; return !( (a_left > b_right) ||