window.onload = function() {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
+ var ground;
var platforms;
var guards;
var guard1, guard2;
function preload () {
- game.load.image('ground', 'ground.svg');
- game.load.image('player_girl', 'csaj.svg');
- game.load.image('player_goat', 'kecskecsaj.svg');
- game.load.image('player_bird', 'bird.svg');
- game.load.image('guard', 'guard.svg');
- game.load.image('birdcage', 'birdcage.svg');
+ game.load.image('ground', 'ground.png');
+ game.load.image('player_girl', 'csaj.png');
+ game.load.image('player_goat', 'kecskecsaj.png');
+ game.load.image('player_bird', 'bird.png');
+ game.load.image('guard', 'guard.png');
+ game.load.image('birdcage', 'birdcage.png');
}
platforms.enableBody = true;
- var ground = game.add.tileSprite(0, game.world.height - 80, game.world.width, 200, 'ground');
+ ground = game.add.tileSprite(0, game.world.height - 80, game.world.width, 200, 'ground');
platforms.add(ground);
ground.body.immovable = true;
player.shape = SHAPE_GIRL;
player.loadTexture('player_girl');
}
+
+ player.body.setSize(player.texture.width, player.texture.height);
+ if ((ground.y - player.y) < player.body.halfHeight)
+ player.y = ground.y - player.body.halfHeight;
+
lastkeytime = game.time.now;
}