Jump to content

How do you use Cloud9 to run game?


Froton X
 Share

Recommended Posts

I hit run and run in debug mode in the workspace and the game wouldn't work, just get a blank page. I had to go with this option as WAMP won't install on my PC due to the C++ database being damaged in my PC.

 

These are the files I have for this quick test game:

 

game.html

game.js

phaser.js

Dragon.png

 

game.html looks like this:

 

<html>
<head>
<script src="phaser.js"></script>
    <script src="game.js"></script>
</head>
 
<body>
</body>
</html>

 

 

game.js
var dragonSprite;var game = new Phaser.Game(800, 600, Phaser.AUTO, '',{ preload: preload, create: create, update: update });function preload() {game.load.image('dragon', 'Dragon.png');}function create() {dragonSprite = game.add.sprite(game.world.centerX,0, 'dragon');dragonSprite.acceleration.y = 100; // gravitydragonSprite.body.collideWorldBounds = true;dragonSprite.body.drag.x = 100;dragonSprite.anchor.setTo(.5, .5);}function update() {if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))  {dragonSprite.velocity.x = -125;dragonSprite.scale.x = 1;} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {dragonSprite.velocity.x = 125;dragonSprite.scale.x = -1;}

I was using an old tutorial video from youtube, I could have sworn there was an official phaser youtube account but I couldn't find it. = (

 
Link to comment
Share on other sites

 

I hit run and run in debug mode in the workspace and the game wouldn't work, just get a blank page. I had to go with this option as WAMP won't install on my PC due to the C++ database being damaged in my PC.

 

These are the files I have for this quick test game:

 

game.html

game.js

phaser.js

Dragon.png

 

game.html looks like this:

 

 

game.js
var dragonSprite;var game = new Phaser.Game(800, 600, Phaser.AUTO, '',{ preload: preload, create: create, update: update });function preload() {game.load.image('dragon', 'Dragon.png');}function create() {dragonSprite = game.add.sprite(game.world.centerX,0, 'dragon');dragonSprite.acceleration.y = 100; // gravitydragonSprite.body.collideWorldBounds = true;dragonSprite.body.drag.x = 100;dragonSprite.anchor.setTo(.5, .5);}function update() {if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))  {dragonSprite.velocity.x = -125;dragonSprite.scale.x = 1;} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {dragonSprite.velocity.x = 125;dragonSprite.scale.x = -1;}

I was using an old tutorial video from youtube, I could have sworn there was an official phaser youtube account but I couldn't find it. = (

 

 

 

Seems like you are missing some code? Function for the upload event is not ended right?

 

Have you check in Chrome or Firefox what the console is saying? If you getting any errors etc. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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