diff --git a/feast.html b/feast.html
index f993994..66af074 100644
--- a/feast.html
+++ b/feast.html
@@ -6,6 +6,7 @@
Feast
+
diff --git a/feast.js b/feast.js
index e05a817..03f72ca 100644
--- a/feast.js
+++ b/feast.js
@@ -6,14 +6,7 @@ let actions = [];
let time = 9*60;
let newline = " ";
-let player = {
- name: "Fen",
- height: 1.55,
- health: 75,
- maxHealth: 100,
- fullness: 35,
- maxFullness: 200
-};
+let player = new Player();
function Object(name="Potato") {
this.name = name;
@@ -31,7 +24,7 @@ function Burger() {
});
}
-function updateExplore() {
+function updateExploreCompass() {
for (let i = 0; i < dirButtons.length; i++) {
let button = dirButtons[i];
if (currentRoom.exits[i] == null) {
@@ -46,12 +39,23 @@ function updateExplore() {
button.innerHTML = currentRoom.exits[i].name;
}
}
-
- for (let i = 0; i < actionButtons.length && i < actions.length; i++) {
- actionButtons[i].innerHTML = actions[i].name;
- actionButtons[i].addEventListener("click", function() { actions[i].action(); });
+}
+function updateExploreActions() {
+ for (let i = 0; i < actionButtons.length; i++) {
+ if (i < actions.length)
+ actionButtons[i].innerHTML = actions[i].name;
+ else
+ actionButtons[i].innerHTML = "";
}
}
+function updateExplore() {
+
+ updateExploreCompass();
+
+ updateExploreActions();
+
+
+}
function updateCombat() {
@@ -117,8 +121,8 @@ function moveTo(room) {
}
window.addEventListener('load', function(event) {
+ loadActions();
loadCompass();
- actionButtons = Array.from( document.querySelectorAll(".action-button"));
currentRoom = createWorld();
currentRoom.objects.push(new Burger());
moveTo(currentRoom);
@@ -135,6 +139,17 @@ function update(lines=[]) {
updateDisplay();
}
+function actionClicked(index) {
+ actions[index].action();
+}
+
+function loadActions() {
+ actionButtons = Array.from( document.querySelectorAll(".action-button"));
+ for (let i = 0; i < actionButtons.length; i++) {
+ actionButtons[i].addEventListener("click", function() { actionClicked(i); });
+ }
+}
+
function loadCompass() {
dirButtons[NORTH_WEST] = document.getElementById("compass-north-west");
dirButtons[NORTH_WEST].addEventListener("click", function() {
diff --git a/vore.js b/vore.js
new file mode 100644
index 0000000..c51f028
--- /dev/null
+++ b/vore.js
@@ -0,0 +1,33 @@
+function Creature(name = "Creature") {
+ this.name = name;
+ this.health = 100;
+ this.maxHealth = 100;
+ this.mass = 80;
+ this.stomach = Stomach();
+}
+
+function Player(name = "Player") {
+ Creature.call(this, name);
+
+ this.fullness = 100;
+ this.maxFullness = 200;
+}
+function Container(name = "stomach") {
+ this.name = name;
+ this.contents = [];
+ this.digest = function() {
+
+ };
+}
+
+function Stomach() {
+ Container.call(this, "stomach");
+
+ this.digest = function() {
+ let lines = [];
+ this.contents.forEach(function (prey) {
+ lines.push("Something is digesting!");
+ });
+ return lines;
+ }
+}