02. Creating an Entity

Introduction

This tutorial provides a set of steps for creating an entity with platformer behavior.

Creating a GameScreen

Although this tutorial is focused on creating a platformer entity, we will first add a GameScreen. Creating a GameScreen first makes it much easier to add an entity after.

Note that you may already have a GameScreen in your project. If so, you can skip this section.

To add a GameScreen:

  1. Select the Quick Actions tab in Glue
  2. Click the Add Screen/Level button
  3. Leave the default GameScreen name
  4. Check both the Add SolidCollision ShapeCollection and Add CloudCollision ShapeCollection options
  5. Click OK

We will return to the GameScreen in future tutorials, but having one created before we create entities will speed up the process.

Creating a MainCharacter Entity

To create an entity with platformer behavior:

  1. Select the Quick Actions tab in Glue
  2. Click the Add Entity button
  3. Enter a name for the entity, such as MainCharacter
  4. Check the AxisAlignedRectangle checkbox – platformer entities perform collision against their environment
  5. Verify that the ICollidable checkbox is checked – this will simplify working with the MainCharacter entity
  6. Change the Input Movement Type to Platformer
  7. Leave the Tiled options selected to automatically create a list for this new entity in GameScreen
  8. Click OK

This will create a new platformer entity with a rich set of default functionality. We can verify that the entity is marked as a platformer by checking its Entity Input Movement tab to verify that it is marked as a platformer and that it has two movement types:

  • Ground
  • Air

Adding MainCharacter to the GameScreen

Now that we have the MainCharater set up with platfomer control values, we can add it to our GameScreen by drag+dropping the MainCharacter onto the GameScreen node. We should already have a MainCharacterList in our GameScreen so the newly-added object will be inside of that list after the drag+drop.

Conclusion

If we run our game now we’ll see the entity functional – at least, it seems to fall with gravity. In the next tutorial we’ll add collision and controls using our entity.