var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });

function preload() {

  game.load.image('sky', 'assets/sky.png');
  game.load.image('ground', 'assets/platform.png');
  game.load.image('star', 'assets/star.png');
  game.load.spritesheet('dude', 'assets/dude.png', 32, 48);

}

function create() {

  //  We're going to be using physics, so enable the Arcade Physics system
  game.physics.startSystem(Phaser.Physics.ARCADE);

  //  A simple background for our game
  game.add.sprite(0, 0, 'sky');

  platforms = game.add.group();

  platforms.enableBody = true;

  game.physics.arcade.enable(platforms);

  var plat_y_pos = 300;

  var plat_width;


  plat_y_pos = 100 + ( Math.floor( ( Math.random() * 400 ) + 1 ) );

  plat_width = Math.floor( ( Math.random() * 2 ) + 1 );

  var ledge = platforms.create( 400, plat_y_pos, 'ground' );

  // ledge.scale( plat_width, 1);

  ledge.body.velocity.x = -150;



  // //  The platforms group contains the ground and the 2 ledges we can jump on
  // platforms = game.add.group();

  // //  We will enable physics for any object that is created in this group
  // platforms.enableBody = true;

  // // Here we create the ground.
  // var ground = platforms.create(0, game.world.height - 64, 'ground');

  // //  Scale it to fit the width of the game (the original sprite is 400x32 in size)
  // ground.scale.setTo(2, 2);

  // //  This stops it from falling away when you jump on it
  // ground.body.immovable = true;

  // //  Now let's create two ledges
  // var ledge = platforms.create(400, 400, 'ground');

  // ledge.body.immovable = true;

  // ledge = platforms.create(-150, 250, 'ground');

  // ledge.body.immovable = true;



}

function update() {


}

var game = new Phaser.Game(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio, Phaser.CANVAS, 'gameArea');


function preload() {

  game.load.image('sky', 'assets/sky.png');
  game.load.image('ground', 'assets/platform.png');
  game.load.image('star', 'assets/star.png');
  game.load.spritesheet('dude', 'assets/dude.png', 32, 48);

}

function create() {

  //  We're going to be using physics, so enable the Arcade Physics system
  game.physics.startSystem(Phaser.Physics.ARCADE);

  //  A simple background for our game
  game.add.sprite(0, 0, 'sky');

  platforms = game.add.group();

  platforms.enableBody = true;

  game.physics.arcade.enable(platforms);

  var plat_y_pos = 300;

  var plat_width;


  plat_y_pos = 100 + ( Math.floor( ( Math.random() * 400 ) + 1 ) );

  plat_width = Math.floor( ( Math.random() * 2 ) + 1 );

  var ledge = platforms.create( 400, plat_y_pos, 'ground' );

  // ledge.scale( plat_width, 1);

  ledge.body.velocity.x = -150;



  // //  The platforms group contains the ground and the 2 ledges we can jump on
  // platforms = game.add.group();

  // //  We will enable physics for any object that is created in this group
  // platforms.enableBody = true;

  // // Here we create the ground.
  // var ground = platforms.create(0, game.world.height - 64, 'ground');

  // //  Scale it to fit the width of the game (the original sprite is 400x32 in size)
  // ground.scale.setTo(2, 2);

  // //  This stops it from falling away when you jump on it
  // ground.body.immovable = true;

  // //  Now let's create two ledges
  // var ledge = platforms.create(400, 400, 'ground');

  // ledge.body.immovable = true;

  // ledge = platforms.create(-150, 250, 'ground');

  // ledge.body.immovable = true;



}

function update() {


}

add scalable screen