0
我是這個初學者,我有我的空間侵略者克隆設置,我學會了如何在互聯網上的各種教程上製作Flash遊戲,但沒有聲音。然而,遊戲運行正常,沒有錯誤,但是,當我按下SPACE鍵時聲音不會播放,這是我想要的那種聲音。下面是下面的代碼上看到PlayerShip.as:Flixel + FlashDevelop聲音沒有播放
package
{
import org.flixel.*;
public class PlayerShip extends FlxSprite
{
[Embed(source = "../img/ship.png")] private var ImgShip:Class;
[Embed(source = "../snd/shoot.mp3")] private var ShootEffect:Class;
public function PlayerShip()
{
super(FlxG.width/2-6, FlxG.height-12, ImgShip);
}
override public function update():void
{
velocity.x = 0;
if(FlxG.keys.LEFT)
velocity.x -= 150;
if(FlxG.keys.RIGHT)
velocity.x += 150;
super.update();
if(x > FlxG.width-width-4)
x = FlxG.width-width-4;
if(x < 4)
x = 4;
if (FlxG.keys.justPressed("SPACE"))
{
var bullet:FlxSprite = (FlxG.state as PlayState).playerBullets.recycle() as FlxSprite;
bullet.reset(x + width/2 - bullet.width/2, y);
bullet.velocity.y = -140;
FlxG.play(ShootEffect);
}
}
}
}
我已經研究了互聯網上,谷歌只顯示瞭如何添加音樂,而不是我說的聲音,請幫助!任何幫助將不勝感激一如既往!