mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.audio('music', 'assets/audio/CatAstroPhi_shmup_normal.wav');
|
||||
|
||||
}
|
||||
|
||||
var music;
|
||||
|
||||
function create() {
|
||||
|
||||
music = game.add.audio('music');
|
||||
|
||||
// play: function (marker, position, volume, loop, forceRestart) {
|
||||
|
||||
music.play('', 0, 1, true);
|
||||
|
||||
game.input.onDown.add(toggleAudio, this);
|
||||
|
||||
}
|
||||
|
||||
function toggleAudio() {
|
||||
|
||||
if (music.isPlaying)
|
||||
{
|
||||
music.pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
music.resume();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderSoundInfo(music, 32, 32);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user