This tutorial will cover how to create an Entity, which is the FRB term for a “game object”. Examples of entities include:
- Game characters (like Mario)
- Projectiles (like a bullet)
- UI elements (like a button)
- Text objects (like a score display)
Our first entity will be called “PlayerBall”.
To create an Entity:
- Click the Add Entity quick action, or right-click on the Entities tree item in Glue and select Add Entity
- Enter the name PlayerBall
- Check the Circle checkbox under the Collisions category. This will add a circle object to our entity, which we’ll use to test if the PlayerBall is touching the walls, goals, or other ball instances.
- Notice that the ICollidable checkbox is checked – we’ll cover this in a later tutorial. We’ll leave it checked for now.
- Click OK
Our entity will now be created and have a Circle under its Objects folder, as shown in the following image:
Alternative Approach – Adding a Circle
The previous section showed how to create an entity and add a Circle to the entity at the same time. Objects can be added after an entity is created as well. Note, the following steps are only shown for example, and do not need to be followed if you performed the previous steps.
To add a Circle to an already-created entity:
- Click the Add Object quick action or right-click on Objects and select Add Object
- Select the FlatRedBall Or Custom Type option
- Select Circle in the list
- Enter the name CircleInstance and click OK
At this point our project has a PlayerBall Entity which is ready to be used in a game. Of course, we haven’t yet created an instance of the newly-created Entity, so if you run your game you won’t see it (yet). The next tutorial will create a Screen which will contain our PlayerBall Entity.