Jump to content

Having several tilemaps next to eachother


Recommended Posts

Hello again! :D

I've been working on this RPG-like game. And I'm using the program Tiled to create tilemaps to be used in-game.

The problem is that I want it to be able to handle "dynamic" tilemaps, I want this so I don't have to have a 10000x10000 big tilemap but instead have several smaller ones.


Keep in mind that this is the first time I'm using tilemaps and I'm thinking of them as big images with smaller images within them.

With this I thought there was some way to place them next to eachother, but experimenting I haven't found it.


There doesn't seem to be any property within the TIlemap-class that decides what x/y-values it should be drawn at.


I've tried creating the maps and layers and then switching the camera.position.


I've tried modifying the layer.cameraOffset, this places the tilemap with offset, but this screws up the camera and the bounds for the camera still doesn't change.


game.world.camera.setBounds() doesn't seem to work when creating the tilemaps, even though I set it to be 10000x10000, I can't scroll beyond the size of the tilemap.

And I've added another function to layers instead of using resizeWorld() I've tried this one:

Phaser.TilemapLayer.prototype.resizeWorldSpecific = function (x,y,width,height) {       this.game.world.setBounds(x, y, width, height);}

But that doesn't work either.

/*Tried setting bounds, size etc here */tileEngine.addMap('tilemap1');tileEngine.addTilesetImage('tilemap1', 'tileset_floor');tileEngine.addTilesetImage('tilemap1', 'tileset_wall');tileEngine.createLayer('tilemap1', 'Background');tileEngine.createLayer('tilemap1', 'Foreground');tileEngine.createLayer('tilemap1', 'Top');/*Here I've been trying to put everything I can think of to change the x/y values / width/height values */tileEngine.addMap('tilemap2');tileEngine.addTilesetImage('tilemap2', 'tileset_floor');tileEngine.addTilesetImage('tilemap2', 'tileset_wall');tileEngine.createLayer('tilemap2', 'Background');tileEngine.createLayer('tilemap2', 'Foreground');tileEngine.createLayer('tilemap2', 'Top');/*Tried setting bounds, size etc here */

tileEngine is just an object which contains the maps / layers etc.


In my mind this seems like it would be possible, am I wrong?


Thanks in advance!

Link to comment
Share on other sites

  • 1 month later...

I have the same situation as you, it's not a small fixed map, rather I have a changeable (currently ~ 400x400 tiles) world in my RPG.


The client will request chunks of map at a time from the server dependent on where the player is.


I'm considering trying http://leafletjs.com/ (used on nimianlegends.com ) or writing my own tiling code, but i'm still investigating options.  :wacko:

Link to comment
Share on other sites


  • Recently Browsing   0 members

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