O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making your HUD scalable

Have you ever played a game that didn't quite fit your screen? It's frustrating, isn't it? In a perfect world, your game would work perfectly on any device. Since that's not the case, however, you'll need to make some adjustments if you want to create a game that will fit at least most devices. Let's see what it takes to scale your game to fit screens of different sizes and ratios.

Getting ready

For this recipe, we'll use the game that we created previously. Open the project file and follow the given steps, but make sure Allow the player to resize the game window is activated and Keep aspect ratio is selected under Global Game Settings.

How to do it

  1. Open obj_display.
  2. Under the DrawGUI event, open the code block.
  3. Enter the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required