Jump to content

Can't get Phaser Working


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>

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

#game_div {
width: 500px;
margin: auto;
margin-top: 50px;

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


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



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);

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...

  • Recently Browsing   0 members

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