az00000 Posted March 2, 2015 Share Posted March 2, 2015 Hello guys i have this code var game = new Phaser.Game( 900, 900, Phaser.AUTH, '', { preload: preload, create: create, update: update });var map, ground, trees, player;function preload() { game.world.setBounds(0,0,1280, 600); game.load.tilemap( 'world', 'assets/javascripts/world.json', null, Phaser.Tilemap.TILED_JSON ); game.load.image('worldtile', 'assets/images/RPG_Maker_VX_RTP_Tileset_by_telles0808.png'); game.load.atlasJSONArray('player', 'assets/images/player.png', 'assets/javascripts/player.json');}function create() { map = game.add.tilemap('world'); map.addTilesetImage('RPG_Maker_VX_RTP_Tileset_by_telles0808', 'worldtile'); ground = map.createLayer('ground'); trees = map.createLayer('trees'); player = game.add.sprite(300, 200, 'player'); game.physics.arcade.enable(player); player.animations.add('down', [0, 1, 2], 15, true, false); player.animations.add('left', Phaser.Animation.generateFrameNames('player-left-', 1, 2, '.png'), 15, true, false); game.camera.follow(player);}function update() { if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { player.body.velocity.y = 40; //player.animations.stop('walk_left'); player.animations.play('down', 5, true); } else if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { player.body.velocity.x = -40; //player.animations.stop('walk_down'); //player.animations.play('left', 5, true); } else { player.animations.stop(); player.body.velocity.x = 0; player.body.velocity.y = 0; }}the tilemap works great but i cant see the player and i get this error:Uncaught TypeError: Cannot read property 'uuid' of undefinedany help ! Link to comment Share on other sites More sharing options...
rich Posted March 3, 2015 Share Posted March 3, 2015 A couple of things:Phaser.AUTHshould be:Phaser.AUTOand are you 100% sure it is actually a atlasJSONArray file? and not a JSONHash? Link to comment Share on other sites More sharing options...
Recommended Posts