function onWeaponFired(){ this.on=1-this.on; if (this.on==1) { //weapon is now on } else { //weapon is now off }}