Jump to content

Strange sound.play() behavior


przemoo83
 Share

Recommended Posts

Hi I have this problem with the sound of firing

	//just shoot	else if(this.game.input.activePointer.isDown) {		throwS.play();		fireBullet();		player.animations.play('throw');	}

It works nicely when mouse button is clicked once. However when the button is pressed and held down for a while, sound is not played until the buton is released. Is there any way to change this behavior?

Link to comment
Share on other sites

I am not sure at all, new to Phaser, just an idea. Maybe you should check if your sound has played to the end (if it's very long sound), by checking isPlaying like this:

	//just shoot	else if(this.game.input.activePointer.isDown) {		if(!throwS.isPlaying) throwS.play();		fireBullet();		player.animations.play('throw');	}
Link to comment
Share on other sites

 

I am not sure at all, new to Phaser, just an idea. Maybe you should check if your sound has played to the end (if it's very long sound), by checking isPlaying like this:

	//just shoot	else if(this.game.input.activePointer.isDown) {		if(!throwS.isPlaying) throwS.play();		fireBullet();		player.animations.play('throw');	}

Thanks for the answer but it doesn't solve the problem. The sound i play is very short. It's a sound of throwing.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...