Skip to content

Instantly share code, notes, and snippets.

@samme
Last active February 6, 2024 19:27
Show Gist options
  • Save samme/c1006080b0cc37c7a563452c61fa6ca3 to your computer and use it in GitHub Desktop.
Save samme/c1006080b0cc37c7a563452c61fa6ca3 to your computer and use it in GitHub Desktop.
Phaser 3 global with ES modules
export const gameConfig = {
scene: {
create: function () {
this.add.text(0, 0, "Hello world");
}
}
};
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser 3 game</title>
<style>html, body { height: 100%; margin: 0; }</style>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.70.0/dist/phaser.js" defer></script>
<script src="main.js" type=module></script>
</head>
<body></body>
</html>
import { gameConfig } from "./gameConfig.js";
new Phaser.Game(gameConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment