Jump to content

Does the coordinate of a sprite changes when the container it belongs to scaled?


neonwarge04
 Share

Recommended Posts

How can I handle sprite coordinates when the container it belongs to scaled? I am trying to resize my game app base on the size of the screen but the scaling seems to disrupt my toons grid location. This is only occurs when I resize (scale) the game to fit the device screen.

What I am trying to do is that I have two containers, MainContainer and SubContainer. MainContainer is what I use generally for common view for example placing some UI parts. The SubContainer is what I use to pan the world around. I have been successful using this setup but it breaks when I scale the screen to fit into the device. For instance I am scaling the MainContainer.

Is there a solution for this? How am I suppose to handle this? What I have been thinking is to get how much pixels do the screen scaled to and account for it and apply the difference to every sprite but I am not sure about this.

Thanks for your help!

Link to comment
Share on other sites

I dont understand whats wrong in your case. If you want sprite coordinates on screen, look at getBounds(). If you want to find all sprites in particular point of screen, use renderer.plugins.interaction.processInteractive, look into https://github.com/pixijs/pixi.js/blob/master/src/interaction/InteractionManager.js#L265 as an example.

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.

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