Adding New Weapons
To add a new weapon to CTFTNKS, follow these steps:
- Create the Weapon Class: Create a new file in
src/entities/weapons/. Inherit from the baseWeaponclass. - Define Behavior: Override the
fire()method to define how the weapon shoots. - Register Weapon: Add the new weapon to
src/entities/weapons/index.ts. - Add Assets: Add a corresponding icon in
public/img/and a sound inpublic/sound/. Updatesrc/game/assets.tsto include them.
Example
typescript
export class MyNewWeapon extends Weapon {
constructor(tank: Tank) {
super(tank);
this.name = "Super Blaster";
this.cooldown = 500;
}
// implementation...
}