Checkpoints

From Game Editor

Jump to: navigation, search

As most things in gameEditor, there are many ways to establish checkpoint systems. One of the easiest ways to set up involves the use of two variables. These variables will be used to hold the xy positions of the last checkpoint, that way you can warp to it using those coordinates. In this example we will be using a very simple checkpoint system. Upon collision with the checkpoint, the position saves, nothing else. Then upon death, destruction of the actor, create the actor at that point. First, create two variables, xCheck and yCheck.


Next you will want to add a collision event with the checkpoint.

player -> Collision (checkpoint) -> Script Editor

xCheck=collide.x;
yCheck=collide.y;


Now your last checkpoint position has been saved. So all you need is the reinitialization of your actor upon death. So add a destroy actor event that creates the actor with those xy coordinates.

player -> DestroyActor -> Script Editor

CreateActor("player", "icon", "(none)", "(none)", xCheck, yCheck, true);


Now you will want to do the create actor yourself allowing for your initial animations, but make sure that the coordinates are not relative to the creator. Other than that, you now have a working checkpoint system. You can even use these along with saveVars and loadVars to save your position after exiting the game. Other variables can be used along with this system to save other factors such as points.