Jump to content

Positioning to bottom pixi.container


Ricky
 Share

Recommended Posts

Another (i don't know if it's stupid) question.

My project work fine on desktop and mobile except portrait mode ??

For example, on samsung S6 the footer object it's well positioned, but not on big screen like iphone XS or S8

I'm using coordinate *.position.x or position.y to move this container, but what is the best practice to implement it?

I mean, it's not like website with align top or align bottom

Thanks for your reply

 

Link to comment
Share on other sites

You could adjust the pivot or anchor points to change how object aligns. For example to align a sprite to the middle & bottom of the screen you could say:

sprite.anchor.set(0.5, 1);
sprite.x = renderer.screen.width/2;
sprite.y = renderer.screen.height;

Without seeing the exact problem it's hard to say what is the correct way to fix it.

Link to comment
Share on other sites

look, there are two approaches:

1. fix canvas size like in https://github.com/ivanpopelyshev/pixi-starfighter/ , please clone it and try

2. resize canvas that way pixi pixel is the same as screen BUT change `stage.scale` that way your stage fits the screen. In local coords of that stage you can use your units.

Try both approaches, then take pen and paper and try to understand how it works and what does suit you.

Link to comment
Share on other sites

  • 2 weeks later...

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

  • Recently Browsing   0 members

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