Sign in to follow this  

Draging a big tilemap

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 ?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.