You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Instances of Humanoid should have all of the same properties as CharacterStats and GameObject.
@@ -41,7 +70,7 @@
41
70
42
71
// Test you work by un-commenting these 3 objects and the list of console logs below:
43
72
44
-
/*
73
+
45
74
constmage=newHumanoid({
46
75
createdAt: newDate(),
47
76
dimensions: {
@@ -102,9 +131,86 @@
102
131
console.log(archer.greet());// Lilith offers a greeting in Elvish.
103
132
console.log(mage.takeDamage());// Bruce took damage.
104
133
console.log(swordsman.destroy());// Sir Mustachio was removed from the game.
105
-
*/
134
+
106
135
107
136
// Stretch task:
108
137
// * Create Villain and Hero constructor functions that inherit from the Humanoid constructor function.
109
138
// * Give the Hero and Villains different methods that could be used to remove health points from objects which could result in destruction if health gets to 0 or drops below 0;
110
-
// * Create two new objects, one a villain and one a hero and fight it out with methods!
139
+
// * Create two new objects, one a villain and one a hero and fight it out with methods!
140
+
141
+
142
+
143
+
/* function Player(name) {
144
+
this.name = name
145
+
}
146
+
147
+
Person.prototype.sayName = function sayName() {
148
+
console.log(`My name is ${this.name} I am team ${this.team}`);
Overview: Study the console.log() and object method invocations at the bottom of the page. Update the Animal and Dog constructors so that the logs and methods match the commented result next to them.
175
+
176
+
Challenge: Add the missing `speak` method, complete the `eat` method
0 commit comments