Tarkunian Posted August 18, 2014 Share Posted August 18, 2014 Hi guys!First of all i am importing tilemap and it's working ok.Then i am adding a player as suggested here: http://www.photonstorm.com/phaser/tutorial-making-your-first-phaser-gameProblem is i can see only tiles, player is invisible!Code is below:var game = new Phaser.Game(640, 480, Phaser.AUTO, '', { preload: preload, create: create, update: update });var map;var tileset;var player;var layer_background;var layer_ground;var a;function preload() { game.load.spritesheet('hero', 'assets/hero.png', 57, 84); game.load.image('tileset', 'assets/tilemap.png'); game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON);} function create() { game.physics.startSystem(Phaser.Physics.ARCADE); player = game.add.sprite(0, 0, 'hero'); game.physics.arcade.enable(player); player.body.bounce.y = 0.2; player.body.gravity.y = 300; player.body.collideWorldBounds = true; player.animations.add('left', [0, 1, 0, 2], 7, true); player.animations.add('right', [3, 4, 3, 5], 7, true); map = game.add.tilemap('map'); map.addTilesetImage('tilemap','tileset'); // !!!! layer_background = map.createLayer("Background"); layer_ground = map.createLayer("Ground"); layer_ground.resizeWorld(); } function update() { game.physics.arcade.collide(player, layer_ground);}Thanks in advance! Link to comment Share on other sites More sharing options...
lewster32 Posted August 18, 2014 Share Posted August 18, 2014 You've added the player before the map, so the map is on top of the player. Link to comment Share on other sites More sharing options...
Tarkunian Posted August 18, 2014 Author Share Posted August 18, 2014 Thank you very much! lewster32 1 Link to comment Share on other sites More sharing options...
Recommended Posts