Jump to content

World Offset


Recommended Posts

That could work I got the world shifted I have code like 


var bounds = new Phaser.Rectangle(0, 0, 400, 400);
customBounds = { left: null, right: null, top: null, bottom: null };
createPreviewBounds(bounds.x, bounds.y, bounds.width, bounds.height);

Of the example and 

txtScore = game.add.text(100,-90, "Coins",style3);

to put stuff in the area above the world. 

Link to comment
Share on other sites

Nice! Glad you found a solution that worked.

If your UI gets more complicated, it might make sense to create two Phaser.Group objects, one for the UI on top, and one for the game area underneath. You could add all your ui objects to the UI group and all your game objects to the game area group.

believe, although I don't have a ton of experience with it, that if you set the position for a group, all of the group's children will be positioned relative to where the group is. So adding a child to the UI group will mean that it's positioned in that top area, and adding a child to the game area group will mean its positioned relative to the bottom area.

Link to comment
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.


  • Recently Browsing   0 members

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