| @@ -96,7 +96,7 @@ function updateDisplay() { | |||||
| document.getElementById("time").innerHTML = "Time: " + renderTime(time); | document.getElementById("time").innerHTML = "Time: " + renderTime(time); | ||||
| document.getElementById("stat-name").innerHTML = "Name: " + player.name; | document.getElementById("stat-name").innerHTML = "Name: " + player.name; | ||||
| document.getElementById("stat-health").innerHTML = "Health: " + player.health + "/" + player.maxHealth; | document.getElementById("stat-health").innerHTML = "Health: " + player.health + "/" + player.maxHealth; | ||||
| document.getElementById("stat-fullness").innerHTML = "Fullness: " + player.fullness + "/" + player.maxFullness; | |||||
| document.getElementById("stat-fullness").innerHTML = "Fullness: " + player.fullness(); | |||||
| } | } | ||||
| function advanceTime(amount) { | function advanceTime(amount) { | ||||
| @@ -14,8 +14,9 @@ function Creature(name = "Creature") { | |||||
| function Player(name = "Player") { | function Player(name = "Player") { | ||||
| Creature.call(this, name); | Creature.call(this, name); | ||||
| this.fullness = 100; | |||||
| this.maxFullness = 200; | |||||
| this.fullness = function() { | |||||
| return this.stomach.fullness(); | |||||
| } | |||||
| } | } | ||||
| function Anthro() { | function Anthro() { | ||||
| @@ -81,6 +82,10 @@ function Container(name) { | |||||
| this.feed = function(prey) { | this.feed = function(prey) { | ||||
| this.contents.push(prey); | this.contents.push(prey); | ||||
| }; | }; | ||||
| this.fullness = function() { | |||||
| return this.contents.reduce((total, prey) => total + prey.mass, 0); | |||||
| } | |||||
| } | } | ||||
| function Stomach(bowels) { | function Stomach(bowels) { | ||||
| @@ -55,7 +55,7 @@ let locationsSrc = [ | |||||
| "desc": "A bare living room", | "desc": "A bare living room", | ||||
| "conn": [ | "conn": [ | ||||
| { | { | ||||
| "name": "Street", | |||||
| "name": "North Street", | |||||
| "dir": NORTH, | "dir": NORTH, | ||||
| "desc": "You step outside." | "desc": "You step outside." | ||||
| }, | }, | ||||
| @@ -71,7 +71,7 @@ let locationsSrc = [ | |||||
| ] | ] | ||||
| }, | }, | ||||
| { | { | ||||
| "name": "Street", | |||||
| "name": "North Street", | |||||
| "desc": "It's a street", | "desc": "It's a street", | ||||
| "conn": [ | "conn": [ | ||||
| { | { | ||||
| @@ -81,7 +81,7 @@ let locationsSrc = [ | |||||
| }, | }, | ||||
| { | { | ||||
| "name": "Living Room", | "name": "Living Room", | ||||
| "dir": SOUTH, | |||||
| "dir": EAST, | |||||
| "desc": "You step back into your apartment." | "desc": "You step back into your apartment." | ||||
| } | } | ||||
| ], | ], | ||||