Jump to content

Total noob need help with Phaser on Cloud9


Recommended Posts

I have simple game that I had working fine on localhost from Visual Code.

Decided to try it out on Cloud9.

Configured Cloud9 user and permissions (separate from Admin group)

I downloaded the phaser-master from github.

The file contains hidden .github folder and .gitignore file.

Then there are v2, v2-community, and v3 folders.

To use Phaser in cloud9 I'm asuming I have to upload the files in the v2 folder. I did that into the cloud9 root.

The html file is:

        <meta charset="UTF-8" />
        <title>Coin Game!</title>
            html { background: black; }
            canvas { margin:auto; }
    <script src="phaser.js"></script>
    <script src="game.js"></script>

It is located in the cloud9 root folder.

I rand npm install experss from the terminal in the cloud9 instance root.

Then I ran npm init --save.

I'm not sure if I have to do this, but I ran a simple install of node.js server from a terminal window in the cloud9 root.

The command I used was: npm install node server 

When I try to run my game.js file from cloud9 editor window, it errors at this line:

// setup game when the web page loads
window.onload = function () {
  game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });

What is says is "window is not defined"

It ran so easily on my local node server.

I did all the local work from Visual Code. It set up and ran the server. It was using an extension called live server. I'm not sure exactly what it does; but if I just open up the local files directory, check node, then run node game.js, I get the same error of window not defined.

I'd like to get this to work on cloud9 for learning purposes.

I'd appreciate any help, please.


Link to comment
Share on other sites


  • Recently Browsing   0 members

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