Jump to content

Problem with Phaser and Matter when adding a TilemapLayer


Steime90
 Share

Recommended Posts

I tried to create a Level with tilemapLayers. After adding everything. I try to display the debugGraphic. It only shows the Ball with a debug circle and the loaded Layers. But it only shows the image no bounding boxes or something like that. Does anyone see the problem here?

 

preload() {
    this.load.atlas('kugellabyrinth', 'assets/Kugellabyrinth.png', 'assets/Kugellabyrinth.json');
    // this.load.tilemapTiledJSON('map', 'assets/map.json');
    // this.load.image('walls', 'assets/Walls.png');
    this.load.tilemapTiledJSON('map', 'assets/rpg_map.json');
    this.load.image('walls', 'assets/[Base]BaseChip_pipo.png');
    console.log('preload method');
  }

  create() {
    this.matter.world.setBounds(0, 0, 512, 512, 32, true, true, true, true);
    console.log('create method');
    this.map = this.make.tilemap({key: 'map'});
    this.tileset = this.map.addTilesetImage('RPG Set', 'walls');
    this.floorLayer  = this.map.createDynamicLayer('Floor', this.tileset, 50, 50);
    this.wallLayer = this.map.createDynamicLayer('Wall', this.tileset, 0, 0);
    this.wallLayer.setCollisionByProperty({collides: true});
    this.matter.world.convertTilemapLayer(this.wallLayer);this.matter.world.convertTilemapLayer(this.floorLayer);
    this.matter.world.createDebugGraphic();
    this.kugel = this.matter.add.image(48, 48, 'kugellabyrinth', 'Kugel.png');
    this.kugel.setCircle(this.kugel.width / 2, { restitution: 1, friction: 0.25 });

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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