main
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>
<p id="command">></p><input type="text" id="userInput" name="inputBox">
<script src="verbhandler.js"></script>
<script src="index.js"></script>
<script src="inventory.js"></script>
<script src="locations.js"></script>
<script src="index.js"></script>
</body>

View File

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

View File

@ -1,3 +1,4 @@
let locations =
{
"Computer Room": {
"objects": {
@ -6,22 +7,22 @@
},
"Northern Door": {
"interactable": true,
"gotoroom": "hallway"
"gotoroom": "hallway"
}
},
"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."
},
"hallway": {
"objects": {
"Northern Door": {
@ -32,7 +33,7 @@
},
"Vase": {
"interactable": true,
"contains": {
"contains": {
"key": {
"grabable": true
}