If you are making a platformer and using Tiled, then you may be using the TileShapeCollection object. If so, then you can use the TileShapeCollection to perform platformer collision.
This tutorial assumes the following:
- You have an Entity that inherits from PlatformerCharacterBase or is of type PlatformerCharacterBase
- You have an instance of this Entity in a Screen. Mine will be called CharacterInstance
- You have a TileShapeCollection instance – I’ll call it SolidCollisions.
The following code can be added to your Screen’s CustomActivity to cause the character to collide with the SolidCollisions:
void CustomActivity(bool firstTimeCalled)
The above code uses a lambda for brevity, but you may want to break it up into separate functions for performance reasons.