Tuesday 15 August 2017

Game Maker Progress 46: Zooming, Tile Up-Scaled and UI Scaling

Hello everyone,

The last week has been focused on something which I've been meaning to do for a while. Previously the sizes of the map tiles were around 200 x 200 pixels. As such - all UI elements were designed with this in mind. This size made it difficult to put certain detail into the art of the game, and as such - I've been meaning to scale it up to a larger amount - a tile is now 800 x 800 pixels. This has meant that the UI needs to also be scaled up in size, to match the new tile sizes as the camera is further zoomed outward. 

Since I was working with the scaling - I decided to put in Zooming once more; since this feature was planned to be in the game - which I decided to put on the backlog for a while. Now re-added - my goal the past week was to ensure that if I decided to scale up the tiles once more - I wouldn't have the issue to re-adjust the size of the UI again. 

After a few days of working out the mathematics of it - it's working quite well! The system essentially increases the scale of the sprite of the UI element, whilst also maintaining it's position on the screen. This was done by using variables containing the distance from the centre of the screen where the camera is centred, and then using percentages to position the elements on the screen. As long as the scale of the image was correct - the element will remain in place whenever you zoom out.

This has - of course - meant that I have a day or two of going through various UI elements and adjusting the code that positions and determines their scale. However once that's done, everything should be in working order and future proofed to deal with this automatically if I decided to upscale the tiles again!

Until next time,
Dylan

No comments:

Post a Comment