From 7084fd3cabc9b729e7e68e1d63ed8fc8afd41546 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 19 Aug 2012 19:39:17 +0200 Subject: [PATCH] debug --- herzle.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/herzle.js b/herzle.js index f460c08..bb12614 100644 --- a/herzle.js +++ b/herzle.js @@ -1,4 +1,4 @@ -debug = false; +debug = true; player_pos = [0.5 * window.innerWidth, 0.9 * window.innerHeight]; enemy_pos = [0.5 * window.innerWidth, 0.1 * window.innerHeight]; @@ -197,7 +197,7 @@ function animate() { // stay inside! if (new_enemy_pos[0] < 0) new_enemy_pos[0] = 0; if (new_enemy_pos[0] > window.innerWidth) new_enemy_pos[0] = window.innerWidth; - if (new_enemy_pos[1] < 0.05 * window.innerHeight) new_enemy_pos[1] = 0.05 * window.innerHeight; + if (new_enemy_pos[1] < 0.1 * window.innerHeight) new_enemy_pos[1] = 0.1 * window.innerHeight; if (new_enemy_pos[1] > 0.5 * window.innerHeight) new_enemy_pos[0] = 0.5 * window.innerHeight; // slowly move to desired position @@ -214,5 +214,16 @@ function gameLoop() { } function init() { + if (debug) { + borderdiv = document.createElement('div'); + borderdiv.style.position = "absolute"; + borderdiv.style.left = "10%"; + borderdiv.style.width = "80%"; + borderdiv.style.top = "10%"; + borderdiv.style.height = "80%"; + borderdiv.style.border = "1px solid"; + var body = document.getElementsByTagName('body')[0]; + body.appendChild(borderdiv); + } gameLoop(); }