Guest User

Untitled

a guest
Mar 28th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. var game = new Phaser.Game(640, 360, Phaser.CANVAS, "content", { preload: preload, create: create, update: update, render: render});
  2.  
  3. var steve;
  4.  
  5. var GameState = {
  6.  
  7. preload: function() {
  8. this.load.image('background', 'assets/clouds.jpg');
  9. this.load.atlasJSONHash('guy', 'assets/steve.png', 'assets/steve.json');
  10. },
  11.  
  12. create: function() {
  13.  
  14. this.physics.startSystem(Phaser.Physics.ARCADE);
  15.  
  16. this.background = this.game.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, 'background');
  17. // this.background.autoScroll(-10, 0);
  18.  
  19. // Steve Sprite
  20. steve = this.add.sprite(500, 225, 'guy');
  21. walk = steve.animations.add('walk');
  22. steve.animations.play('walk', 8, true);
  23.  
  24. steve.anchor.setTo(0, 1);
  25. steve.scale.x = -1;
  26.  
  27. // Add physics to Steve
  28. this.physics.enable(steve, Phaser.Physics.ARCADE);
  29.  
  30. },
  31.  
  32. update: function() {
  33.  
  34. }
  35.  
  36. render: function() {
  37.  
  38. game.debug.spriteInfo(sprite, 32, 32);
  39.  
  40. }
  41.  
  42. }
  43.  
  44. game.state.add('GameState', GameState);
  45.  
  46. game.state.start('GameState');
Advertisement
Add Comment
Please, Sign In to add comment