Selaa lähdekoodia

Added a Wilderness area to get lost in

tags/v0.2.8
Fen Dweller 7 vuotta sitten
vanhempi
commit
5ee984bcf3
3 muutettua tiedostoa jossa 43 lisäystä ja 4 poistoa
  1. +7
    -1
      feast.js
  2. +20
    -0
      objects.js
  3. +16
    -3
      world.js

+ 7
- 1
feast.js Näytä tiedosto

@@ -1,3 +1,4 @@
let world = null;

let currentRoom = null;
let currentDialog = null;
@@ -251,6 +252,10 @@ function move(direction) {
moveTo(target,currentRoom.exitDescs[direction]);
}

function moveToByName(roomName, desc="You go places lol") {
moveTo(world[roomName], desc);
}

function moveTo(room,desc="You go places lol") {
actions = [];
currentRoom = room;
@@ -279,7 +284,8 @@ function start() {
loadActions();
loadCompass();
loadDialog();
currentRoom = createWorld();
world = createWorld();
currentRoom = world["Bedroom"];
respawnRoom = currentRoom;
moveTo(currentRoom);
updateDisplay();


+ 20
- 0
objects.js Näytä tiedosto

@@ -125,3 +125,23 @@ function VendingMachine() {
}
});
}

function WildernessExplore(natureTrail) {
GameObject.call(this, "Explore the Wilderness");

this.actions.push({
"name": "Explore",
"action": function() {
let outcome = Math.random();
advanceTime(60*15);

if (outcome < 0.25) {
moveToByName("Nature Trail", "You find your way back");
} else if (outcome < 0.5) {
startCombat(new Anthro());
} else {
update(["You wander around for a bit, but haven't found anything."]);
}
}
});
}

+ 16
- 3
world.js Näytä tiedosto

@@ -12,8 +12,6 @@ let SOUTH_WEST = 5;
let WEST = 6;
let NORTH_WEST = 7;

let startLocation = "Bedroom";

let locations = {};

let locationsSrc = [
@@ -190,6 +188,11 @@ let locationsSrc = [
"name": "South Street",
"dir": NORTH,
"desc": "You return to town."
},
{
"name": "Wilderness",
"dir": SOUTH,
"desc": "You wander into the wilderness...and immediately get lost."
}
],
"objs": [
@@ -197,6 +200,16 @@ let locationsSrc = [
GetaObj
]
},
{
"name": "Wilderness",
"desc": "Pretty spooky",
"conn": [

],
"objs": [
WildernessExplore
]
},
{
"name": "DANGER ZONE",
"desc": "THE DANGER ZONE",
@@ -313,5 +326,5 @@ function createWorld() {
}
}

return locations[startLocation];
return locations;
}

Loading…
Peruuta
Tallenna