diff --git a/classes.php b/classes.php index eb9f79f..332ae85 100644 --- a/classes.php +++ b/classes.php @@ -136,6 +136,7 @@ class Party public $_health = "Good"; #general health of the party public $_supplies; #supplies class instant public $_livingMembers = 5; #licing members of the party + public $_leader; public $_rate = 3; #rate at which food is eaten public $_job; public $_jobVal = [["empty",0],["Banker", 1600.00], @@ -150,6 +151,7 @@ public function __construct($names, $job) $this->_members[3] = new PartyMember($names[3]); $this->_members[4] = new PartyMember($names[4]); + $this->_leader = $names[0]; #supplies made by passing in starting money $this->_job = $job; @@ -174,21 +176,35 @@ public function eat() #checks if any members can be killed (has 0 health) public function killCheck() { + $checkLeader = false; foreach($this->_members as $body) { if($body->_alive) { if($body->_health <= 0) { + $checkLeader = true; $body->_alive = false; $this->_livingMembers-=1; + } } } + if ($checkLeader) + { + foreach($this->_members as $body) + { + if($body->_alive) + { + $this->_leader = $body->_name; + break; + } + } #code for when all members are dead #ends game } + } #averages health and assigns a rating public function health() diff --git a/gameover.php b/gameover.php new file mode 100644 index 0000000..3b80e2f --- /dev/null +++ b/gameover.php @@ -0,0 +1,28 @@ +_distance; +$leader = $_SESSION["playParty"]->_leader; +?> +
+Here Lies
+You died miles along the path.
+You were miles from your goal
+
+What would you like on your tombstone?
+