Jump to content

Tilemaps caching


Recommended Posts

Hi! A couple of days ago I started with PhaserJS. Wonderful engine! And easily enough, specially when you come from a just-canvas environment. :)

After reading a little about the platform, I started to code my homepage, made originally in EaselJS, in PhaserJS (http://ludobermejo.es/). I created a Tilemap with multiple layers, I exported it and I loaded it into PhaserJS. And I have some problems: everything's cool if I don't move the background, but when I move it, FPS drops to 20 or even 15. I'm pretty sure this is because the rendering of the tilemap. If I use a background PNG image with the same size of the map and I only use the collisions layer, it works perfectly! But if I use all the layers then the movement becomes a pain.

Now, the questions:

a ) Is there any way I can make a "memory screenshot" of the tilemap first time is rendered? Maybe I can render the tilemap, then make a copy, then make all layers invisible

b ) Is there a better solution? I'm all ears :)

BTW, if you want to check the code, please be free: https://github.com/LudoBermejo/PhaserTutorial/tree/map. Right now it's working with the background image, but it has the collisions activated.


Link to comment
Share on other sites


  • Recently Browsing   0 members

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