Skip to content

Instantly share code, notes, and snippets.

@modemlooper
Created August 18, 2023 14:49
Show Gist options
  • Save modemlooper/feb75726250ebe34bde9cd4e6986a621 to your computer and use it in GitHub Desktop.
Save modemlooper/feb75726250ebe34bde9cd4e6986a621 to your computer and use it in GitHub Desktop.
phaser test
<html>
<head>
<title>Gamefroot Arcade</title>
<style>
body, html {
margin: 0;
padding: 0;
background: black;
overflow: hidden;
}
#game-container {
margin: auto;
}
</style>
<script src="libs/phaser.js"></script>
<script>
class Example extends Phaser.Scene {
preload () {
this.load.audio('convo', [
'https://smp.dev.apppresser.com/wp-content/uploads/2023/08/day-1-1.mp3'
]);
this.load.audio('background', [
'assets/audio/1692317314673-1679002482779-Dare-38-Track-1.mp3'
]);
}
create () {
const music = this.sound.add('background', {volume: 0.5, loop: true });
music.play();
// const convo = this.sound.add('convo');
// convo.play();
}
}
const config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: Example,
audio: {
disableWebAudio: false
}
};
new Phaser.Game(config);
</script>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment