Jump to content

Draging a big tilemap


Benjans
 Share

Recommended Posts

Hi everyone,

 

I'm trying to create a city builder with Phaser (i'm currently switching from Quintus to Phaser ;) ).

My map is displayed properly, and it is much bigger than the canvas. I want to make it dragable, so I tried many solutions, like this one :

        function create() {                        console.time('Create');                        map = game.add.tilemap('world');            tileset = game.add.tileset('tiles');            layer = game.add.tilemapLayer(0, 0, viewportWidth, viewportHeight, tileset, map, 0);            layer.resizeWorld();                        //  Input Enable the sprites            layer.inputEnabled = true;            //  Allow dragging            //  enableDrag parameters = (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite)            layer.input.enableDrag(true);            /*            var text = "Debug()";            var style = { font: "12px Arial", fill: "#ff0044", align: "center" };            var debug = game.add.text(0, 0, text, style);            debug.input.onDown.addOnce(debug, this);            */                        console.timeEnd('Create');        }

It does not work, I can not drag the map, nothing moves...

Can you help me ?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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