背景音乐
要添加背景音乐到您的游戏,添加一个新的声音对象,并开始播放,当你开始游戏:
Example
var myGamePiece;
var myObstacles = [];
var mySound;
var myMusic;
function startGame() {
myGamePiece = new component(30, 30, "red", 10, 120);
mySound = new sound("bounce.mp3");
myMusic = new sound("gametheme.mp3");
myMusic.play();
myGameArea.start();
}
|