nyan
This commit is contained in:
parent
93534f2832
commit
7e9fdb3af5
3 changed files with 12 additions and 17 deletions
|
@ -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>
|
9
index.js
9
index.js
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
let locations =
|
||||||
{
|
{
|
||||||
"Computer Room": {
|
"Computer Room": {
|
||||||
"objects": {
|
"objects": {
|
||||||
|
@ -6,17 +7,17 @@
|
||||||
},
|
},
|
||||||
"Northern Door": {
|
"Northern Door": {
|
||||||
"interactable": true,
|
"interactable": true,
|
||||||
"gotoroom": "hallway"
|
"gotoroom": "hallway"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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."
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
},
|
},
|
||||||
"Vase": {
|
"Vase": {
|
||||||
"interactable": true,
|
"interactable": true,
|
||||||
"contains": {
|
"contains": {
|
||||||
"key": {
|
"key": {
|
||||||
"grabable": true
|
"grabable": true
|
||||||
}
|
}
|
Loading…
Reference in a new issue