Hi everyone,
I am having a really hard time getting Phaser to run on VS Code. I have the framework and my game.js file, and I tried loading a background image for my game, but all I see is a black square when I open it with the Live server, or my Wampp server. This is my html:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.24.0/dist/phaser.js"></script>
<script src="game.js"></script>
And this is my game.js file:
var game = new Phaser.Game(640, 360, Phaser.AUTO);
var GameState = {
preload: function() {
this.load.image('sky', 'assets/sky.png');
},
create: function() {
this.background = this.game.add.sprite(0, 0, 'sky');
},
update: function() {
}
};
game.state.add(‘GameState’, GameState);
game.state.start(‘GameState’);
If anyone could help, I’d really appreciate it.