Jump to content

Can't get Phaser Working


facetiousfactorial.cs
 Share

Recommended Posts

For the past few days, I have been unable to get phaser to work: just trying to test a hello world program. I've followed the directions on phaser's site exactly, and it still isn't working for me.


I am using node.js.


Here is index.html:



<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>Hello World</title>

<style>
#game_div {
width: 500px;
margin: auto;
margin-top: 50px;
}
</style>

<script type="text/javascript" src="phaser.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>

<body>

<div id="game_div"> </div>

</body>

</html>

Here is main.js:



/*jslint node: true */
"use strict";
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'game_div');

var main_state = {

preload: function () {
game.load.image('hello', 'assets/hello.png');
},

create: function () {
this.hello_sprite = game.add.sprite(200, 245, 'hello');
},

update: function () {
this.hello_sprite.angle += 1;
}
}

game.state.add('main', main_state);
game.state.start('main');

The error it gives me is:



'Phaser' was used before it was defined. var game = new Phaser.Game(400, 490,
Phaser.AUTO, 'game_div');

I've really tried looking for solutions to this, but I can't find anything wrong. I'm pretty new to javascript and phaser.


Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...