Having trouble displaying a sprite.
Here is the HTML file :
<head>
<script src="https://github.com/photonstorm/phaser-ce/releases/download/v2.7.5/phaser.min.js"></script>
</head>
<body>
<div id="game"></div>
<script src="main.js"></script>
</body>
Contents of main.js
:
(() => {
var preload = () => {
Game.load.image("player", "assets/player.png");
},
create = () => {
Game.add.sprite(225, 450, "player");
},
update = () => {
},
Game = new Phaser.Game(500, 500, Phaser.AUTO, "game",
{
preload : "preload",
create : "create",
update : "update"
}
);
})();
The sprite is not displaying and there is only a black background. The Firefox developer console shows an error:
TypeError: this.onPreloadCallback.call is not a function
.