Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var game = new Phaser.Game(640, 360, Phaser.CANVAS, "content", { preload: preload, create: create, update: update, render: render});
- var steve;
- var GameState = {
- preload: function() {
- this.load.image('background', 'assets/clouds.jpg');
- this.load.atlasJSONHash('guy', 'assets/steve.png', 'assets/steve.json');
- },
- create: function() {
- this.physics.startSystem(Phaser.Physics.ARCADE);
- this.background = this.game.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, 'background');
- // this.background.autoScroll(-10, 0);
- // Steve Sprite
- steve = this.add.sprite(500, 225, 'guy');
- walk = steve.animations.add('walk');
- steve.animations.play('walk', 8, true);
- steve.anchor.setTo(0, 1);
- steve.scale.x = -1;
- // Add physics to Steve
- this.physics.enable(steve, Phaser.Physics.ARCADE);
- },
- update: function() {
- }
- render: function() {
- game.debug.spriteInfo(sprite, 32, 32);
- }
- }
- game.state.add('GameState', GameState);
- game.state.start('GameState');
Advertisement
Add Comment
Please, Sign In to add comment