Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Tilemap not showing


noob42
 Share

Recommended Posts

 hello everyone i have been trying my best to load a tilemap that i created in tiled but to no avail, chrome keeps giving me this error Phaser.Tileset - actual and expected number of tile rows and columns differ,

 

 

(function (Phaser){

var game= new Phaser.Game(640,480,Phaser.AUTO,'game',{
    
    preload:preload,
    create:create,
    update:update
});
 function preload(){
     
   
    
 //game.load.image('character', "asset/Idle.png");
game.load.tilemap('tilemap','asset/leveltrial.json', null,Phaser.Tilemap.TILED_JSON);
 game.load.image('tiles',"asset/map.png");
 }
var player;
var facing="left";
var hozMove=300;
var vertMove=-240;
var jumpTimer=0;
var map;
var layer;
    
    
function create(){
    game.stage.backgroundColor='#00000';
    //game.physics.startSystem(Phaser.Physics.ARCADE);
    map=game.add.tilemap('tilemap');
    map.addTilesetImage('platformer','tiles');
   
    
    layer=map.createLayer('Tile Layer 1');
    //glayer=map.createLayer('Grounlayer');
    // map.setCollisionBetween(1,5,true,'Background');
   
   // player=game.add.sprite(64,64,'character');
    
   // game.physics.enable(player);
    layer.resizeWorld();
    
    
    //player.body.collideWorldBounds=true;
    //player.body.gravity.y=300;
    //game.camera.follow(player);  
    }
    
function update(){
    /*game.physics.arcade.collide(player,layer);
    player.body.velocity.x=0;
    
    if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
        {
            player.body.velocity.x=-hozMove;
            if(facing!=="left"){
                facing="left";
            }
        }
  else  if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
        {
            player.body.velocity.x=hozMove;
            if(facing!=="right"){
                facing="right";
            }
        }
    
    if (game.input.keyboard.isDown(Phaser.Keyboard.UP) && player.body.onFloor() && game.time.now>jumpTimer){
        player.body.velocity.y=vertMove;
        jumpTimer=game.time.now + 650;
    }*/
  
}
    
}(Phaser));

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...