Tutorial: Making Checkpoints

Learn how to make certain types of games and use gameEditor.

Tutorial: Making Checkpoints

Postby Bee-Ant » Sun Jul 18, 2010 7:27 pm

Hi newbies... :D
Well, I was told to make this tutorial..I'm not a good tutor anyway, but I'll try...


The System
The system is you will save your current location, defined by the x and y axis into variables, then you can save that variables into file. For example your save file will be "data.sav". In this system, you have Actors called "Player" as your main player, and "Checkpoint" as the checkpoint actor. Well, the you can use some flag sprite as the checkpoint actor.

Requirements
The requirement is only 2 variables. "PosX" - to define the x position, and "PosY" to define the y position. To make the variable, go to the Script Editor or Global code, then click "Variables" button bellow the window.
Image
You need to make the Save group in order to save them into file.

The Script
Here's the scripting step...
1. First, we want to save the current location when the Player colliding with the Checkpoint flag. So, we need to put this code on...
Player -> Collision -> Anyside of Checkpoint -> Script Editor
:
Code: Select all
PosX = x; //store the x position
PosY = y; //store the y position
saveVars("data.sav", "data"); //save the data into file "data.sav"

2. Then, we want if the player die, he will load his latest checkpoint location. In this case, the Player dying with DestroyActor, so on...
Player -> Destroy Actor -> Script Editor :
Code: Select all
CreateActor("Player", "PlayerAnimation", "(none)", "(none)", PosX, PosY, true); //create player to the latest checkpoint location
view.x=PosX-320; //set the view x position
view.y=PosY-240; //set the view y position

We need to set the view position in order for the camera will follow the Player.
3. The last is, when next time we play the game again, and want to load the latest checkpoint... So, on...
Player -> Create Actor -> Script Editor :
Code: Select all
loadVars("data.sav", "data"); //load your saved data from file
x=PosX; //set the x position
y=PosY; //set the y position
view.x=PosX-320; //set the view x position
view.y=PosY-240; //set the view y position


Please Note
Whenever we change the Player's location, don't forget to move the view's location as well. Or else, the camera won't follow you.

Hope helps, and thanks :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Hblade » Mon Jul 19, 2010 2:42 am

I added this to the Tutorials page


http://game-editor.com/Tutorials
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Bee-Ant » Mon Jul 19, 2010 4:05 am

Nice, thanks :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby krenisis » Mon Jul 19, 2010 4:37 am

Good job bee-ant!! Now when anybody asks you , you dont have to retype same code over. Now just put the link to your tutorial and your set. Plus it will help Makslane sell more and make more improvements because Game Editor has best support staff of any IDE.
Tutorial Database for all beginners click this link
viewtopic.php?f=4&t=8680
krenisis
 
Posts: 606
Joined: Sat Jul 25, 2009 3:27 pm
Score: 51 Give a positive score

Re: Tutorial: Making Checkpoints

Postby JLx14 » Sat Aug 28, 2010 7:55 pm

thanks it works but i cant make the camera view follow the player after he dies. it just stays where the checkpoint is.
JLx14
 
Posts: 2
Joined: Sat Aug 28, 2010 7:52 pm
Score: 0 Give a positive score

Re: Tutorial: Making Checkpoints

Postby DBGames » Sat Aug 28, 2010 9:58 pm

very nice tutorial, however... your images look weird... :| whats up with that?
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Bee-Ant » Sat Aug 28, 2010 10:00 pm

JLx14 wrote:thanks it works but i cant make the camera view follow the player after he dies. it just stays where the checkpoint is.

If you follow all the instruction, you should be OK...
DBGames wrote:very nice tutorial, however... your images look weird... :| whats up with that?

I used 256 color since GE won't allow me to upload big image.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby DBGames » Sat Aug 28, 2010 10:08 pm

really? well, i tryed running my ge in 256 color ind it crashed immediatly... :(

on a side not, does this stupid java pop up P.O any one? we need to tell mak to change that back N O W.
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: Tutorial: Making Checkpoints

Postby NightOfHorror » Sat Aug 28, 2010 11:08 pm

This maybe can help on my game, more like everybody's game(by the way it is called THE CHALLENGE and I know some of you might be interested, like bee-ant will probaly want to be the lead character designer) so thanks. :D
viewtopic.php?f=2&t=12136
"I have not failed. I just found 10,000 ways that wont work." quoted by Thomas Edison.
Over the year, I decided my motto for me is I am knowledgeable, but not practical.
User avatar
NightOfHorror
 
Posts: 1823
Joined: Fri Aug 27, 2010 2:50 am
Location: Cedar Hill, MO, of the USA
Score: 51 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Bee-Ant » Sun Aug 29, 2010 10:01 am

Bee-Ant wrote:I used 256 color since GE won't allow me to upload big image.

I mean GE forum, sorry...
DBGames wrote:on a side not, does this stupid java pop up P.O any one? we need to tell mak to change that back N O W.

I have asked Makslane before, but he didn't hear me...
It seems I need more vote on this matter
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby JLx14 » Sun Aug 29, 2010 6:13 pm

I followed everything, its just the last part where you say "don't forget to move the view's location as well. Or else, the camera won't follow you." I'm not sure what you mean by that. Im sorry im new to game-editor i just started using it 3 days ago
JLx14
 
Posts: 2
Joined: Sat Aug 28, 2010 7:52 pm
Score: 0 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Bee-Ant » Mon Aug 30, 2010 3:20 am

JLx14 wrote:I followed everything, its just the last part where you say "don't forget to move the view's location as well. Or else, the camera won't follow you." I'm not sure what you mean by that. Im sorry im new to game-editor i just started using it 3 days ago

Oh, it's just a warning...
Actually it has done by this code :
Code: Select all
view.x=PosX-320; //set the view x position
view.y=PosY-240; //set the view y position

Well, logically, after your player get Destroyed, then you Create a new player...
Put that code on Player -> Create Actor
I'm so sure there's something you missed :s
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby mog440 » Fri Dec 24, 2010 10:13 am

I followed this instructions and it didnt work when I went to game mode, but once I exited game mode, and went to game mode again,I started in the saved position( the checkpoint position) can you help?
And i presume I have to also destroy the checkpoint actor as I can collide more then once and create many players?
mog440
 
Posts: 12
Joined: Mon May 24, 2010 11:02 am
Score: 0 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Bee-Ant » Fri Dec 24, 2010 4:36 pm

In this tutorial, you will start from the checkpoint location when the player has died before.
"CreateActor() when colliding the checkpoint"?? I believe I didn't post this sentence on the first post.
When player collides the checkpoint, you just need to set the PosX and PosY values depend on the player'r X and y
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Tutorial: Making Checkpoints

Postby Pyathus » Mon Jun 27, 2011 3:39 pm

i cannot seem to get the view to follow the actor after I get killed and load at the nearest checkpoint. and the view also gets affected depending on what side (left/right/top) my character hits the enemy.
Pyathus
 
Posts: 12
Joined: Mon Jun 13, 2011 2:59 am
Score: 0 Give a positive score

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest