So, i have 3 weapons ENR.45 SPO-5.56 and the Hellfire12 (name to be determined) and only the SPO fires, the other 2 dont, theyre both in the same spot in the script, and its the same code with the variables cahnges, any ideas?
heres the code, all the variables have been checked and double checked
//Shoot ENR
Movement.prototype.onMouseDown = function(event) {
if (this.app.root.findByName('ENR.45').enabled === true) {
// shooting code
if (event.button === pc.MOUSEBUTTON_LEFT) {
// shoot
if (this.sporounds !== 0) {
var bullet = this.app.root.findByName('ENRBullet').clone();
this.app.root.addChild(bullet);
bullet.reparent(this.app.root);
bullet.setPosition(this.app.root.findByName('ENRBullet').getPosition());
bullet.setRotation(this.app.root.findByName('ENRBullet').getRotation());
bullet.enabled = true;
console.log(bullet);
// update magazine
this.enrrounds = this.enrrounds - 1;
}
}
}
// Function end
};
//Shoot Hellfire
Movement.prototype.onMouseDown = function(event) {
if (this.app.root.findByName('Hellfire12').enabled === true) {
// shooting code
if (event.button === pc.MOUSEBUTTON_LEFT) {
// shoot
if (this.sporounds !== 0) {
var bullet = this.app.root.findByName('Shells').clone();
this.app.root.addChild(bullet);
bullet.reparent(this.app.root);
bullet.setPosition(this.app.root.findByName('Shells').getPosition());
bullet.setRotation(this.app.root.findByName('Shells').getRotation());
bullet.enabled = true;
console.log(bullet);
// update magazine
this.sporounds = this.sporounds - 1;
}
}
}
// Function end
};
//Shoot SPO
Movement.prototype.onMouseDown = function(event) {
if (this.app.root.findByName('SPO-5.56').enabled === true) {
// shooting code
if (event.button === pc.MOUSEBUTTON_LEFT) {
// shoot
if (this.sporounds !== 0) {
var bullet = this.app.root.findByName('SPOBullet').clone();
this.app.root.addChild(bullet);
bullet.reparent(this.app.root);
bullet.setPosition(this.app.root.findByName('SPOBullet').getPosition());
bullet.setRotation(this.app.root.findByName('SPOBullet').getRotation());
bullet.enabled = true;
console.log(bullet);
// update magazine
this.sporounds = this.sporounds - 1;
}
}
}
// Function end
};