This commit is contained in:
Luna 2021-07-09 13:57:51 -07:00
parent 93534f2832
commit 7e9fdb3af5
3 changed files with 12 additions and 17 deletions

View file

@ -8,6 +8,7 @@
</div> </div>
<p id="command">></p><input type="text" id="userInput" name="inputBox"> <p id="command">></p><input type="text" id="userInput" name="inputBox">
<script src="verbhandler.js"></script> <script src="verbhandler.js"></script>
<script src="index.js"></script>
<script src="inventory.js"></script> <script src="inventory.js"></script>
<script src="locations.js"></script>
<script src="index.js"></script>
</body> </body>

View file

@ -1,15 +1,8 @@
const userInput = document.getElementById("userInput"); const userInput = document.getElementById("userInput");
var locations;
var currentLocation; var currentLocation;
let gameOver; let gameOver;
async function parseJson() { function main() {
const result = await fetch("./locations.json")
locations = await result.json()
}
async function main() {
await parseJson();
currentLocation = Object.keys(locations)[0] currentLocation = Object.keys(locations)[0]
printBold(locations[currentLocation].onEntry) printBold(locations[currentLocation].onEntry)
} }

View file

@ -1,3 +1,4 @@
let locations =
{ {
"Computer Room": { "Computer Room": {
"objects": { "objects": {
@ -10,11 +11,11 @@
} }
}, },
"verbs": { "verbs": {
"go north": { "go north": function(inventory, currentLocation, etc) {
printBold("uwu");
}, },
"use computer": { "go east": function(inventory, currentLocation, etc) {
printBold("uwuwu");
} }
}, },
"onEntry": "You are in a dark room. With only a COMPUTER, and a monitor dimly illuminating the room. Type LOOK to see your surroundings." "onEntry": "You are in a dark room. With only a COMPUTER, and a monitor dimly illuminating the room. Type LOOK to see your surroundings."