03. Creating a Screen

Introduction

Screens and Entities are two common concepts in Glue. A Screen represents a container for game content and other Entities. Screens define the flow of your game. Often game developers will create many screens up-front to help them think through a game’s structure.

  • Game play Screen (like the playing Screen in Pong)
  • Splash Screen (like a FlatRedBall logo displaying splash Screen)
  • Main menu Screen

Creating a Screen

As you work with Screens you will find that they are very similar to Entities. To create a Screen:

  1. Right-click on the Screens folder
  2. Select Add Screen
    AddScreen.png
  3. Enter the name GameScreen and click OK
    GameScreenName.png

You should now have a Screen in game called GameScreen.

Screens as Entity containers

All Glue projects must have at least one Screen for anything to be visible when the game runs. Once you have at least one Screen in your game, you can add Entity instances to that Screen. Entities can be added through Glue or through game code. To add an Entity instance through Glue, drag+drop the PlayerBall entity onto the GameScreen.

Alternative Approach – Creating an Entity

Entities instances can also be created through the right-click menu on the Screen’s Objects folder.

  1. Right-click on your GameScreen’s Objects folder
  2. Select Add Object
  3. Select Entity as the object type
  4. Select PlayerBall as the type. The name will automatically be changed to PlayerBallInstance
  5. Click OK

NewPlayerBallInstance.png

Viewing your Game

The Preview window will display your game when the GameScreen is selected. You can also run the game through Visual Studio.

Conclusion

To recap we now have an Entity called PlayerBall which has a Circle. We’ve also created a GameScreen which contains an instance of our PlayerBall. We’re now ready to start adding some code to our project. The next tutorial will cover controlling your Entity’s movement.

<- Creating an EntityControlling an Entity ->