I’m trying to make a game with a rocket ship navigating in a cave. The cave is broken up into 400x400 big tiles that’s combined to form a bigger cave. They all have physics-maps from “PhysicsEditor” that seems to work correctly.
My tileclass:
export default class Tile extends Phaser.Physics.Matter.Sprite {
constructor(scene, x, y, sprite, phymap) {
super(scene.matter.world, x, y, sprite, 0, {
shape: phymap
});
this.setStatic(true);
this.setBounce(0.05);
scene.add.existing(this);
}
}
And these are added in game.js:
tilemap[1][0] = new Tile(this, 0, 0, 'ground', tile_body.ground)
tilemap[0][0] = new Tile(this, -400, 0, 'bottom-left', tile_body.bottom_left)
tilemap[0][1] = new Tile(this, -400, -400, 'vertical', tile_body.vertical)
But the tiles are all over the place, if I set them all on position (0, 0) you can see it more clearly:
What am I not understanding?