Automating GameObject Scaling and Positioning Based on Screen Size in Phaser 3 #6900
monteiz
started this conversation in
Feature Requests
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I often encounter the need to adjust game object positions and scales based on the screen size. My approach typically involves setting the positions and scales of game objects relative to a "reference object", which could be the main camera or a specially chosen object within the game.
To handle screen resizing, I use the
scene.scale.on('resize', ...)
event to recalculate and reassign positions based on this reference object. While this method works, it can become quite tedious and repetitive, especially in more complex scenes.Here's a simplified version of my current approach:
My Questions:
Is there an existing mechanism or pattern in Phaser 3 that can help automate this process, reducing the manual effort required for resizing and repositioning game objects?
Are there any best practices or utilities within Phaser 3 that are specifically designed to handle dynamic scaling and positioning efficiently?
Would it be beneficial to create a plugin or helper function to manage these adjustments, or is there a simpler solution I'm overlooking?
Beta Was this translation helpful? Give feedback.
All reactions