I'll do both. First, you need to create two variables, in the demo I named them xCheck, and yCheck. Now these are the coordinates of the last checkpoint hit. To set these, add a collision event with the checkpoint actor, might as well set the collision not to repeat. Next you should put this code
- Code: Select all
xCheck=collide.x;
yCheck=collide.y;
Your positions are now set. Now in the demo I had mouse button down right to destroy the actor, but your health depletion will do the trick. Then on the event of DestroyActor, you should recreate the actor with the xy coordinates as xCheck and yCheck, make sure that position is set to true, not relative to the creator. That should do the trick. To explain the demo, the red actor is the player, it will only be red when in game mode. Now you can drag him around by holding left click, the green actors are the checkpoints. Right clicking will destroy the actor and make a new one wherever the last checkpoint he collided with was. If you any questions, or this doesn't work for you, I'll see what I can do.