Add debug info
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
<button id="rotate-ccw" xmlns="http://www.w3.org/1999/xhtml">⟲</button>
|
<button id="rotate-ccw" xmlns="http://www.w3.org/1999/xhtml">⟲</button>
|
||||||
<button id="rotate-cw" xmlns="http://www.w3.org/1999/xhtml">⟳</button>
|
<button id="rotate-cw" xmlns="http://www.w3.org/1999/xhtml">⟳</button>
|
||||||
<button id="fire" xmlns="http://www.w3.org/1999/xhtml">Fire</button>
|
<button id="fire" xmlns="http://www.w3.org/1999/xhtml">Fire</button>
|
||||||
|
<pre id="debug" xmlns="http://www.w3.org/1999/xhtml"></pre>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
const rules = document.styleSheets[0].cssRules;
|
const rules = document.styleSheets[0].cssRules;
|
||||||
|
|
||||||
const fps = document.querySelector("#fps");
|
const fps = document.querySelector("#fps");
|
||||||
|
const info = document.querySelector("#debug");
|
||||||
const tank = document.querySelector(".tank");
|
const tank = document.querySelector(".tank");
|
||||||
const gun = tank.querySelector('line');
|
const gun = tank.querySelector('line');
|
||||||
const hitbox = document.querySelector(".hitbox");
|
const hitbox = document.querySelector(".hitbox");
|
||||||
@@ -169,6 +171,11 @@
|
|||||||
|
|
||||||
if (delta >= 1000) {
|
if (delta >= 1000) {
|
||||||
fps.innerText = frameCount;
|
fps.innerText = frameCount;
|
||||||
|
|
||||||
|
info.innerText = 'bullets\nx\ty\tvx\tvy\n' + bullets.map((b, index) => {
|
||||||
|
return `${b.x.toFixed(2)}\t${b.y.toFixed(2)}\t${b.vx.toFixed(2)}\t${b.vy.toFixed(2)}`;
|
||||||
|
}).join("\n");
|
||||||
|
|
||||||
zero = timestamp;
|
zero = timestamp;
|
||||||
frameCount = 0;
|
frameCount = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user