| @@ -1,4 +1,23 @@ | |||||
| body { | |||||
| background: #111; | |||||
| color: #eee; | |||||
| } | |||||
| button { | |||||
| background: #222; | |||||
| color: #eee; | |||||
| } | |||||
| .compass-button { | .compass-button { | ||||
| width: 100px; | width: 100px; | ||||
| height: 100px; | height: 100px; | ||||
| } | } | ||||
| #log { | |||||
| background: #222; | |||||
| width: 500px; | |||||
| height: 700px; | |||||
| } | |||||
| #stats { | |||||
| float: right; | |||||
| } | |||||
| @@ -17,7 +17,11 @@ | |||||
| <body> | <body> | ||||
| <div id="location"> | |||||
| <div id="stats"> | |||||
| potato vore | |||||
| </div> | |||||
| <div id="log"> | |||||
| </div> | </div> | ||||
| @@ -33,3 +37,4 @@ | |||||
| <button class="compass-button" id="compass-south-east">South East</button> | <button class="compass-button" id="compass-south-east">South East</button> | ||||
| </div> | </div> | ||||
| </body> | </body> | ||||
| </html> | |||||
| @@ -10,6 +10,8 @@ function move(direction) { | |||||
| alert("Tried to move to an empty room!"); | alert("Tried to move to an empty room!"); | ||||
| return; | return; | ||||
| } else { | } else { | ||||
| currentRoom = target; | |||||
| update(["You move to " + currentRoom.name]); | |||||
| updateDisplay(); | updateDisplay(); | ||||
| } | } | ||||
| @@ -21,6 +23,15 @@ window.addEventListener('load', function(event) { | |||||
| updateDisplay(); | updateDisplay(); | ||||
| }); | }); | ||||
| function update(lines=[]) { | |||||
| let log = document.getElementById("log"); | |||||
| for (let i=0; i<lines.length; i++) { | |||||
| let div = document.createElement("div"); | |||||
| div.innerHTML = lines[i]; | |||||
| log.appendChild(div); | |||||
| } | |||||
| } | |||||
| function loadCompass() { | function loadCompass() { | ||||
| document.getElementById("compass-north-west").addEventListener("click", function() { | document.getElementById("compass-north-west").addEventListener("click", function() { | ||||
| move(NORTH_WEST); | move(NORTH_WEST); | ||||
| @@ -14,6 +14,7 @@ let NORTH_WEST = 7; | |||||
| function Location(name="Nowhere") { | function Location(name="Nowhere") { | ||||
| this.name = name; | this.name = name; | ||||
| this.description = "Not much of anything, really."; | |||||
| this.exits = [null,null,null,null,null,null,null,null]; | this.exits = [null,null,null,null,null,null,null,null]; | ||||
| } | } | ||||