Checkpoint and Level End
Last updated
Last updated
This walkthrough covers concepts related to creating an end-of-level entity which moves the player to the next level and creating a checkpoint which lets the player start at a midpoint in a level after dying.
The sample project can be downloaded from GitHub: https://github.com/vchelaru/FlatRedBall/tree/NetStandard/Samples/Platformer/CheckpointAndLevelEndDemo
This walkthrough refers to CheckpointAndEndLevelDemo as the demo and this demo.
This walkthrough covers a number of concepts for checkpoints and end of level:
Creating instances of Checkpoint and EndOfLevel entities in Tiled on object layers to allow different values on each instance
Storing the current checkpoint name in a static variable so it persists across Screen instances
Spawning and re-spawning the player at checkpoint locations
Collision between the Player and objects controlling spawning (Checkpoint, EndOfLevel, and PitCollision)
This demo includes two levels: Level1 and Level2. Each level has its own TMX file: Level1Map.tmx and Level2Map.TMX. If your project used the platformer plugin then it should have these by default. If your game already has existing levels, you can follow along but you will work in your existing levels rather than Level1 and Level2.
The checkpoints and doors will be added to a Tiled object layer. You must have at least one object layer on each level which should include a checkpoint. For this video we'll use the name GameplayObjectLayer so that it is similar to the standard GameplayLayer.
We will create two entities: Checkpoint and EndOfLevel.
To add a Checkpoint entity:
Right-click on the Entities folder
Select Add Entity
Enter the name Checkpoint
Check the AxisAlignedRectangle option
Click OK
Repeat the process above to create an EndOfLevel entity