Hello, I’m trying to simulate the firing of a firearm in a 2D game, I managed to do this, but, the gun fires several times, is it possible to make 1 firing per 1 click of the mouse?
The code is basically (in update function):
this.pointer = this.input.activePointer;
if (this.pointer.leftButtonDown()) {
this.bullets.fireBullet(gunCoordinates, this);
}
The code you passed helped me to fire 1 time per click, but I couldn’t fire it several times when I held the click, so I added the getDuration method and it started to work very close to what I want, it was like this: