I would like to "extend" a new class from an existing class and include it's methods and parameter construction.
System = function(name, hp){
this.name = name;
this.hp = [];
this.setHP = function(hp){
this.hp[0] = hp;
this.hp[1] = hp;
}
this.setHP(hp);
}
Weapon = function(name, hp){
System.call(this);
}
Weapon.prototype = new System(name, hp);
Weapon.prototype.constructor = Weapon;
var gun = new Weapon("Gun", 10); // undefined name, hp
var hangar = new System("Hangar", 10); // works
So, this is as far as i got, and someone is obviously wrong. Can someone advise me ?