02. Creating an Entity

Introduction

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”.

Creating PlayerBall

To create an Entity:

  1. Right-click on the Entities tree item in Glue
  2. Select Add Entity
    AddEntity.png
  3. Enter the name PlayerBall
  4. 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.
  5. Notice that the ICollidable checkbox is checked – we’ll cover this in a later tutorial. We’ll leave it checked for now.
  6. 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:

  1. Right-click on Objects
  2. Select “Add Object”
    AddObject.png
  3. Select the “FlatRedBall Type” option
  4. Select “Circle” in the list
  5. Enter the name “Body” and click OK
    BodyName.png

Viewing the Entity

At this point the PlayerBall entity can be previewed through the preview window (which is also called GlueView):

  1. Click the “Show Preview” checkbox

  2. If it isn’t selected, select the PlayerBall Entity and it will show in the preview window

CircleInGlueView.png

Conclusion

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.

<- Create a Glue ProjectCreate a Screen ->