Sign in to follow this  
Ricky

Positioning to bottom pixi.container

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

 

Share this post


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

Share this post


Link to post
Share on other sites

is there some way to convert position value in pixel?

For example i know what is the dimension of screen in pixel, i could convert this value in "pixi unit", so moving y value

is it a wrong idea?

Share this post


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

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.