Hi, I just set up Phaser on my Webserver and was trying the Hello World Example, however all I got was a black canvas and no error message.
Here's my simple code:
<!doctype html>
<html>
<head>
<title>phas3r</title>
<script src="phaser.min.js"></script>
<script src="game.js"></script>
</head>
<body>
</body>
</html>
window.onload = function() {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', {
preload: preload,
create: create
});
function preload() {
game.load.image('logo', 'phaser.png');
}
function create() {
var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo');
logo.anchor.setTo(0.5, 0.5);
console.log(logo);
}
};
The two JS are loaded correctly and the window.onload function is fired. However the preload and the create functions are not fired.
The only message in Chrome's console is the "rainbowy" phaser-init message:
11:23:24.916 phaser.min.js:1 Phaser v3.1.0 (WebGL | Web Audio) https://phaser.io
Am I missing something?
I'm using IIS