Sign in to follow this  
s4m_ur4i

Set world Point(0,0)

Recommended Posts

Is there a way to define the x/y = 0/0 Point in Phaser? I could not find anything on the forum / docu.

So everything is aligned from 0/0 - I want to set a padding of "300" around the whole game. (example)
So that the camera can freely move around. The game itself is centered. But there are also renderable object ins space like (-2590, 30)

Anyway of doing that?
I tried to set negative world bounds and to resize the world.
It does nothing at all.

Share this post


Link to post
Share on other sites

Hi, not completely sure about your problem, but this sets 0,0 coordinates into center of screen:

            // set world and camera
            this.world.setBounds(-this.game.width / 2, -this.game.height / 2, this.game.width, this.game.height);
            this.camera.focusOnXY(0, 0);

 It is good for single-screen game. If you need to scroll freely anywhere, then set this:

this.camera.bounds = null;

 

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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.