diff --git a/index.html b/index.html index b1bf881..e8a8095 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ JavaScript game controls - + @@ -120,7 +120,7 @@ function mouseMoveHandler(e) { playerX = e.pageX - canvas.offsetLeft - playerWidth / 2; playerY = e.pageY - canvas.offsetTop - playerHeight / 2; - output.innerHTML = "Mouse:
"+ " x: " + playerX + ", y: " + playerY; + output.textContent = `Mouse:\nx: ${playerX}, y: ${playerY}`; } // TOUCH @@ -130,7 +130,7 @@ if(e.touches) { playerX = e.touches[0].pageX - canvas.offsetLeft - playerWidth / 2; playerY = e.touches[0].pageY - canvas.offsetTop - playerHeight / 2; - output.innerHTML = "Touch:
"+ " x: " + playerX + ", y: " + playerY; + output.textContent = `Touch:\nx: ${playerX}, y: ${playerY}`; e.preventDefault(); } } @@ -141,7 +141,7 @@ var buttonsPressed = []; function gamepadHandler(e) { controller = e.gamepad; - output.innerHTML = "Gamepad: " + controller.id; + output.textContent = `Gamepad: ${controller.id}`; } function gamepadUpdateHandler() { buttonsPressed = []; @@ -174,10 +174,7 @@ horizontalDegree = Math.round(hand.roll() * toDegrees); verticalDegree = Math.round(hand.pitch() * toDegrees); grabStrength = hand.grabStrength; - output.innerHTML = "Leap Motion:
" - + " roll: " + horizontalDegree + "°
" - + " pitch: " + verticalDegree + "°
" - + " strength: " + grabStrength; + output.textContent = `Leap Motion: \nroll: ${horizontalDegree}°\npitch: ${verticalDegree}°\nstrength: ${grabStrength}`; } });