src/weapon.js
/*
 * Create a new weapon type.
 *
 * obj: The weapon class prototype
 * obj.init: Initialization function, takes (game) as parameter
 * name: Human-readable Name of the weapon
 * tier: Weapon tier, a non-negative integer
 * sprite: Weapon sprite
 */
Create a new weapon type.
Create a new weapon type .
function createType(obj) {
	var ctor = obj.init, name = obj.name, tier = obj.tier, sprite = obj.sprite;
	ctor.prototype = Object.create(Weapon.prototype);
	_.assign(ctor.prototype, obj);
	var type = new WeaponType(sprite, name, ctor);
	while (Tiers.length <= tier) {
		Tiers.push([]);
	}
	Tiers[obj.tier].push(type);
	if (obj.debug) {
		debugWeapon = type;
	}
}
function createType ( obj ) { var ctor = obj . init , name = obj . name , tier = obj . tier , sprite = obj . sprite ; ctor . prototype = Object . create ( Weapon . prototype ) ; _ . assign ( ctor . prototype , obj ) ; var type = new WeaponType ( sprite , name , ctor ) ; while ( Tiers . length <= tier ) { Tiers . push ( [ ] ) ; } Tiers [ obj . tier ] . push ( type ) ; if ( obj . debug ) { debugWeapon = type ; } }
Create a new weapon type.
Create a new weapon type .