JSFiddle - React, Tailwind, and code Playground
by dledle2
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Maze Editor & Game (Touchscreen with Web Audio) v32</title>
<style>
/* Add this to existing styles */
.dragging {
opacity: 0.7;
}
/* Add this to the existing styles */
#bidirectionalCheckbox {
margin-left: 10px;
vertical-align: middle;
}
/* Add to existing styles */
#manualTeleportCheckbox {
margin-left: 10px;
vertical-align: middle;
}
.color-wall {
transition: all 0.3s ease-out;
position: relative;
z-index: 1;
}
body {
font-family: sans-serif;
text-align: center;
margin: 20px;
width: 420px;
margin: auto;
}
canvas {
border: 2px solid #000;
background-color: #f0f0f0;
display: block;
margin: 10px auto;
touch-action: manipulation;
}
button {
margin: 5px;
padding: 10px 15px;
font-size: 14px;
}
#controls, #touchControls {
margin-top: 10px;
}
#touchControls {
display: none;
}
.dpad {
display: inline-block;
}
.dpad-row {
display: flex;
justify-content: center;
}
.dpad button {
width: 60px;
height: 60px;
margin: 2px;
}
</style>
</head>
<body>
<h1>Maze Editor & Game</h1>
<canvas id="mazeCanvas" width="400" height="400"></canvas>
<!-- External win sound -->
<audio id="congratsAudio">
<source src="game_mazewin.mp3" type="audio/mpeg">
</audio>
<div id="controls">
<!-- Add this with the other buttons -->
<div>
<label>
<input type="checkbox" id="bidirectionalCheckbox">
Bidirectional Teleporters
</label>
</div>
<!-- Add this with the other controls -->
<div>
<label>
<input type="checkbox" id="manualTeleportCheckbox" checked>
Enable T-key Teleport
</label>
</div>
<br>
<button id="addColorWallBtn">Add Color Wall</button>
<!--...