checkpoints

Non-platform specific questions.

checkpoints

Postby skatebored0m » Thu Aug 13, 2009 5:24 am

Hey
I need some help making checkpoints. I dont know how to save the coordinates of the checkpoint when you collide with it and load it after the HP bar goes to 0. If someone could explain that along or give me a link with a simple demo or something it would help a lot.
skatebored0m
 
Posts: 2
Joined: Wed Aug 05, 2009 3:26 am
Score: 0 Give a positive score

Re: checkpoints

Postby skydereign » Thu Aug 13, 2009 8:07 am

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.
Attachments
check.zip
(1.54 KiB) Downloaded 92 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: checkpoints

Postby skatebored0m » Thu Aug 20, 2009 8:59 pm

The way I have my game set up, the view has Player1 set as it's parent so that Player1 is always in the center of the view. Whenever Player1 is destroyed and recreated at the checkpoint, the view no longer follows Player1. Can anyone fix this? Ill try to attach what I have in my game so people can see exactly what the problem is. (just walk right into the water to kill Player1).
Attachments
Cushing's Quest.zip
unzip it first
(1.26 MiB) Downloaded 90 times
skatebored0m
 
Posts: 2
Joined: Wed Aug 05, 2009 3:26 am
Score: 0 Give a positive score

Re: checkpoints

Postby skydereign » Thu Aug 20, 2009 9:10 pm

Well, it doesn't look like there is a checkpoint system setup, but this is what you should do. On the create actor event of your player, add this to the script editor, or just click the ChangeParent.

player->Create Actor->Script Editor
Code: Select all
ChangeParent("view", "Event Actor");


You would do this for just the view, as anything else should be parented to the view.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron