Skip to content

Commit ab92705

Browse files
committed
updated instructions on readme and comments
1 parent 7ab5a53 commit ab92705

File tree

2 files changed

+121
-16
lines changed

2 files changed

+121
-16
lines changed

README.md

+28-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ For each test you complete:
1212
3. Check if the test passes.
1313
4. If it passes, commit your work.
1414

15+
---
16+
17+
### Help
18+
19+
20+
1521
---
1622

1723
Item(name)
@@ -30,8 +36,9 @@ Weapon(name, damage)
3036
*Creates a weapon item.*
3137
*Weapon items can be equipped for use in battle.*
3238

33-
Use the `call` method on the Item constructor.
34-
Set Weapon's prototype to a new instance of Item.
39+
The Weapon class constructor will call
40+
the super class `Item` constructor
41+
while passing in the 1 `Item` constructor param
3542

3643
**Parameters**
3744
`name`: string, The weapon's name.
@@ -46,8 +53,9 @@ Food(name, energy)
4653
*Creates a food item.*
4754
*Food items give energy, restoring health to the player.*
4855

49-
Use the `call` method on the Item constructor.
50-
Set Food's prototype to a new instance of Item.
56+
The Food class constructor will call
57+
the super class `Item` constructor
58+
while passing in the 1 Item constructor param
5159

5260
**Parameters**
5361
`name`: string, The food's name.
@@ -219,6 +227,10 @@ Set FastZombie's prototype to a new instance of Zombie.
219227
`strength`: number, The zombie's strength.
220228
`speed`: number, The zombie's speed.
221229

230+
#### FastZombie Extends Zombie Class
231+
The FastZombie class will extend the Zombie class prototype
232+
233+
222234

223235
StrongZombie(health, strength, speed)
224236
-----------------------------
@@ -232,6 +244,10 @@ Set StrongZombie's prototype to a new instance of Zombie.
232244
`strength`: number, The zombie's strength.
233245
`speed`: number, The zombie's speed.
234246

247+
#### StrongZombie Extends Zombie Class
248+
The StrongZombie class will extend the Zombie class prototype
249+
250+
235251

236252
RangedZombie(health, strength, speed)
237253
-----------------------------
@@ -245,6 +261,10 @@ Set RangedZombie's prototype to a new instance of Zombie.
245261
`strength`: number, The zombie's strength.
246262
`speed`: number, The zombie's speed.
247263

264+
#### RangedZombie Extends Zombie Class
265+
The RangedZombie class will extend the Zombie class prototype
266+
267+
248268

249269
ExplodingZombie(health, strength, speed)
250270
-----------------------------
@@ -257,3 +277,7 @@ Set ExplodingZombie's prototype to a new instance of Zombie.
257277
`health`: number, The zombie's health.
258278
`strength`: number, The zombie's strength.
259279
`speed`: number, The zombie's speed.
280+
281+
#### ExplodingZombie Extends Zombie Class
282+
The ExplodingZombie class will extend the Zombie class prototype
283+

zombies.js

+93-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/**
2+
* Class => Item(name)
3+
* -----------------------------
24
* Creates an item.
35
*
46
* @name Item
@@ -8,11 +10,14 @@
810

911

1012
/**
13+
* Class => Weapon(name, damage)
14+
* -----------------------------
1115
* Creates a weapon item.
1216
* Weapon items can be equipped for use in battle.
1317
*
14-
* Use the call method on the Item constructor.
15-
* Set Weapon's prototype to a new instance of Item.
18+
* The Weapon class constructor will call
19+
* the super class (Item) constructor
20+
* while passing in the 1 Item constructor param
1621
*
1722
* @name Weapon
1823
* @param {string} name The weapon's name.
@@ -22,11 +27,21 @@
2227

2328

2429
/**
30+
* Weapon Extends Item Class
31+
* -----------------------------
32+
*/
33+
34+
35+
36+
/**
37+
* Class => Food(name, energy)
38+
* -----------------------------
2539
* Creates a food item.
2640
* Food items give energy, restoring health to the player.
2741
*
28-
* Use the call method on the Item constructor.
29-
* Set Food's prototype to a new instance of Item.
42+
* The Food class constructor will call
43+
* the super class (Item) constructor
44+
* while passing in the 1 Item constructor param
3045
*
3146
* @name Food
3247
* @param {string} name The food's name.
@@ -36,6 +51,15 @@
3651

3752

3853
/**
54+
* Food Extends Item Class
55+
* -----------------------------
56+
*/
57+
58+
59+
60+
/**
61+
* Class => Player(name, health, strength, speed)
62+
* -----------------------------
3963
* Creates a player in a zombie-infested world.
4064
*
4165
* @name Player
@@ -57,6 +81,8 @@
5781

5882

5983
/**
84+
* Player Class Method => checkPack()
85+
* -----------------------------
6086
* Player checks the contents of their pack.
6187
*
6288
* Nicely format and print the items in the player's pack.
@@ -68,6 +94,8 @@
6894

6995

7096
/**
97+
* Player Class Method => takeItem(item)
98+
* -----------------------------
7199
* Player takes an item from the world and places it into their pack.
72100
*
73101
* Player's pack can only hold a maximum of 3 items, so if they try to add more
@@ -85,6 +113,8 @@
85113

86114

87115
/**
116+
* Player Class Method => discardItem(item)
117+
* -----------------------------
88118
* Player discards an item from their pack.
89119
*
90120
* Use Array's indexOf method to check if the pack contains the item.
@@ -110,6 +140,8 @@
110140

111141

112142
/**
143+
* Player Class Method => equip(itemToEquip)
144+
* -----------------------------
113145
* Player equips a weapon item.
114146
*
115147
* Player can only equip Weapon instances.
@@ -129,6 +161,8 @@
129161

130162

131163
/**
164+
* Player Class Method => eat(itemToEat)
165+
* -----------------------------
132166
* Player eats a food item, restoring their health.
133167
*
134168
* Player can only eat Food instances.
@@ -147,6 +181,8 @@
147181

148182

149183
/**
184+
* Player Class Method => useItem(item)
185+
* -----------------------------
150186
* Player uses an item from the pack.
151187
*
152188
* If the item is a weapon, the player should equip the item.
@@ -159,6 +195,8 @@
159195

160196

161197
/**
198+
* Player Class Method => equippedWith()
199+
* -----------------------------
162200
* Player checks their equipment.
163201
*
164202
* Prints the player's name and equipped weapon's name.
@@ -172,6 +210,8 @@
172210

173211

174212
/**
213+
* Class => Zombie(health, strength, speed)
214+
* -----------------------------
175215
* Creates a normal zombie.
176216
*
177217
* @name Zombie
@@ -187,10 +227,13 @@
187227

188228

189229
/**
230+
* Class => FastZombie(health, strength, speed)
231+
* -----------------------------
190232
* Creates a fast zombie.
191233
*
192-
* Use the call method on the Zombie constructor.
193-
* Set FastZombie's prototype to a new instance of Zombie.
234+
* The FastZombie class constructor will call
235+
* the super class (Zombie) constructor
236+
* while passing in the 3 Zombie constructor params
194237
*
195238
* @name FastZombie
196239
* @param {number} health The zombie's health.
@@ -200,10 +243,20 @@
200243

201244

202245
/**
246+
* FastZombie Extends Zombie Class
247+
* -----------------------------
248+
*/
249+
250+
251+
252+
/**
253+
* Class => StrongZombie(health, strength, speed)
254+
* -----------------------------
203255
* Creates a strong zombie.
204256
*
205-
* Use the call method on the Zombie constructor.
206-
* Set StrongZombie's prototype to a new instance of Zombie.
257+
* The StrongZombie class constructor will call
258+
* the super class (Zombie) constructor
259+
* while passing in the 3 Zombie constructor params
207260
*
208261
* @name StrongZombie
209262
* @param {number} health The zombie's health.
@@ -213,10 +266,20 @@
213266

214267

215268
/**
269+
* StrongZombie Extends Zombie Class
270+
* -----------------------------
271+
*/
272+
273+
274+
275+
/**
276+
* Class => RangedZombie(health, strength, speed)
277+
* -----------------------------
216278
* Creates a ranged zombie.
217279
*
218-
* Use the call method on the Zombie constructor.
219-
* Set RangedZombie's prototype to a new instance of Zombie.
280+
* The RangedZombie class constructor will call
281+
* the super class (Zombie) constructor
282+
* while passing in the 3 Zombie constructor params
220283
*
221284
* @name RangedZombie
222285
* @param {number} health The zombie's health.
@@ -226,10 +289,20 @@
226289

227290

228291
/**
292+
* StrongZombie Extends Zombie Class
293+
* -----------------------------
294+
*/
295+
296+
297+
298+
/**
299+
* Class => ExplodingZombie(health, strength, speed)
300+
* -----------------------------
229301
* Creates an exploding zombie.
230302
*
231-
* Use the call method on the Zombie constructor.
232-
* Set ExplodingZombie's prototype to a new instance of Zombie.
303+
* The ExplodingZombie class constructor will call
304+
* the super class (Zombie) constructor
305+
* while passing in the 3 Zombie constructor params
233306
*
234307
* @name ExplodingZombie
235308
* @param {number} health The zombie's health.
@@ -238,6 +311,14 @@
238311
*/
239312

240313

314+
/**
315+
* ExplodingZombie Extends Zombie Class
316+
* -----------------------------
317+
*/
318+
319+
320+
321+
241322
/**
242323
* Sample run.
243324
* Feel free to edit this and check your game logic.

0 commit comments

Comments
 (0)