Skip to content

Instantly share code, notes, and snippets.

@samme
Last active February 6, 2024 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samme/88a13b20b997a9b3fa75db750b4e555f to your computer and use it in GitHub Desktop.
Save samme/88a13b20b997a9b3fa75db750b4e555f to your computer and use it in GitHub Desktop.
Phaser 3 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">
<link rel=modulepreload href="https://cdn.jsdelivr.net/npm/phaser@3.70.0/dist/phaser.esm.js">
<title>Phaser 3 with ES modules</title>
<style>html, body { height: 100%; margin: 0; }</style>
<script src="main.js" type=module></script>
</head>
<body></body>
</html>
import { Game } from "https://cdn.jsdelivr.net/npm/phaser@3.70.0/dist/phaser.esm.js";
import { gameConfig } from "./gameConfig.js";
new Game(gameConfig);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment