mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
46 lines
799 B
PHP
46 lines
799 B
PHP
<?php
|
|
$title = "Using samples and looping";
|
|
require('../head.php');
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function () {
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create});
|
|
|
|
function preload() {
|
|
|
|
game.load.image('spyro', 'assets/pics/spyro.png');
|
|
|
|
// Firefox doesn't support mp3 files, so use ogg
|
|
game.load.audio('squit', ['assets/audio/SoundEffects/squit.mp3', 'assets/audio/SoundEffects/squit.ogg']);
|
|
|
|
}
|
|
|
|
var s;
|
|
var music;
|
|
|
|
function create() {
|
|
|
|
game.stage.backgroundColor = '#255d3b';
|
|
|
|
|
|
music = game.add.audio('squit',1,true);
|
|
|
|
music.play('',0,1,true);
|
|
|
|
s = game.add.sprite(game.world.centerX, game.world.centerY, 'spyro');
|
|
s.anchor.setTo(0.5, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
<?php
|
|
require('../foot.php');
|
|
?>
|