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:
- Right-click on the Screens folder
- Select Add Screen
- Enter the name GameScreen and click OK
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.
- Right-click on your GameScreen’s Objects folder
- Select Add Object
- Select Entity as the object type
- Select PlayerBall as the type. The name will automatically be changed to PlayerBallInstance
- Click OK
Viewing your Game
The Preview window will display your game when the GameScreen is selected. You can also run the game through Visual Studio.
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.