File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,27 +37,25 @@ class CharacterStats extends GameObject {
3737 }
3838
3939 takeDamage ( ) {
40- return `${ this . name } took damage.`
40+ return `${ this . name } took damage.` ;
4141 }
4242
4343}
4444
4545
4646
47- function Humanoid ( attributes ) { // (Having an appearance or character resembling that of a human.) ===
48- CharacterStats . call ( this , attributes ) ;
49-
50- this . team = attributes . team ;
51- this . weapons = attributes . weapons ;
52- this . language = attributes . language ;
53-
54- }
55-
56- Humanoid . prototype = Object . create ( CharacterStats . prototype ) ;
57- Humanoid . prototype . greet = function ( ) {
58- return `${ this . name } offers a greeting in ${ this . language } `
59- } ;
60-
47+ class Humanoid extends CharacterStats { // (Having an appearance or character resembling that of a human.) ===
48+ constructor ( humanoidAttributes ) {
49+ super ( humanoidAttributes ) ;
50+ this . team = humanoidAttributes . team ;
51+ this . weapons = humanoidAttributes . weapons ;
52+ this . language = humanoidAttributes . language ;
53+ }
54+ greet ( ) {
55+ return `${ this . name } offers a greeting in ${ this . language } ` ;
56+ }
57+ }
58+
6159 function Villain ( attributes ) {
6260 Humanoid . call ( this , attributes ) ;
6361 }
You can’t perform that action at this time.
0 commit comments