使用Phaser API时,我在碰撞中遇到了一些问题。
我有以下代码:
game.physics.arcade.collide(sprite1, sprite2, this.collision, null, this);
collsion: function(){
//Play a sound;
}
Run Code Online (Sandbox Code Playgroud)
这里的问题是当两个精灵碰撞时,声音会继续播放。它们只有在不碰撞时才会停止。但是我只想播放一次声音。