Code a Score Display in GameMaker: Studio - dummies

Code a Score Display in GameMaker: Studio

By Michael Rohde

By writing code to create the score display on your game in GameMaker: Studio, you can customize it to your liking, without necessarily having to use images. With that said, the following example uses the ScoreBox image, which you can find in the Graphics folder of the assets for the in-software coding tutorial.

  1. Choose Resources→Create Sprite.

    The Sprite Properties window appears.

  2. In the name field, type something like spr_scorebox.

  3. Choose Load Sprite.

    A navigation window opens.

  4. Navigate to thescorebox.png on your PC, or whichever image you want to use.

  5. Select the image file and choose Open from the navigation window.

    A thumbnail of the image appears in the Sprite Properties window.

  6. For the Origin, click Center (see the figure).

    GameMaker determines the center of the image — in this case, X becomes 48 and Y becomes 16 (refer to the figure). This will help you align the text for the score and lives later on.

    The Sprite Properties window.
    The Sprite Properties window.
  7. Click OK.

    The Sprite Properties window is saved and closed.

You just created a Sprite that you can use as part of your score display.