Save Game

Talk about making games.

Save Game

Postby Behdadsoft » Mon Nov 08, 2010 6:57 am

Hi.

I made space invaders and want add auto save for game. Every step means starting a save is automatically created.
I also made a menu and I want every time players of the game came out and wanted to re-enter the game click on the game loaded, the game continues to run.
I do not know programming if you please help me.

THANKS A LOT
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Save Game

Postby skydereign » Mon Nov 08, 2010 7:46 am

You'll need to explain a little more. What triggers the autosave? Every time you move to the next wave the game saves, or perhaps a timer? Also how do the levels start? The mechanics for the autosave feature would be similar to that of any save system. You'll need to specify what needs to be saved. If you can give me more of an idea on how your game runs, I can help.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Save Game

Postby Behdadsoft » Mon Nov 08, 2010 11:41 am

Thanks for Reply

This game is such that the loss of all enemies goes to the next step.
I like when the stage began, life, Score and the stage is running (for example: Step 2). Be saved at that moment.
And when the players disappeared and was going to play the same stage starts by clicking on the game load game menu, the same stage with all the values to be implemented by Save.

This is a Picture my Game

Image
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Save Game

Postby skydereign » Mon Nov 08, 2010 9:57 pm

Here is a quick example of what you want to do. The points to note are the calls to saveVars, and loadVars. Each time you defeat all the enemies in the wave, it calls the nextWave function in global code.
Code: Select all
void
nextWave()
{
    int i;
    int j;
    for(i=0;i<6;i++)
    {
      for(j=0;j<level+1;j++)
      {
        CreateActor("enemShips", "icon", "(none)", "(none)", view.x+120+i*60, view.y+120+j*20, true);
      }
    }
    saveVars("save","save");
}


The call to saveVars will only happen each time you go to the next level and it will save the amount of lives you have, health, your score, and what level you are on. Now to load a game, you would use the code in the create actor event of the view.
Code: Select all
loadVars("save","save");
nextWave();


If you want the player to be able to select load game from a menu, you would move the loadVars to that, and trigger the new wave of enemies. Essentially this is just the normal method of saving, except you automate the process instead of having the player click a save button.
Attachments
saveExample.zip
(19.9 KiB) Downloaded 77 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Save Game

Postby Behdadsoft » Tue Nov 16, 2010 10:26 am

Thank you.

But my game stages are separate and I do not know how should I use this code.
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Save Game

Postby skydereign » Wed Nov 17, 2010 8:19 am

If they are separate that actually makes it easier. As long as in the view's create actor event, you insert the loadVars code, and upon level completion (when you move to the next ged), put the saveVars. The autosave is just you putting in the saveVars code in the event that ends the level. An example would be putting it into the DestroyActor of the enemy actor type.
Enemy -> Destroy Actor -> Script Editor
Code: Select all
if(ActorCount("Enemy")==1) // event actor is the last enemy
{
    saveVars("savegroup", "savegroup");
    LoadGame("game.ged");
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Save Game

Postby Behdadsoft » Wed Nov 17, 2010 7:16 pm

Thank you.
I know how to go one stage to another stage. I wonder how, after being destroyed, again via the menu can be loaded from the same stage of game play continues.
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Save Game

Postby skydereign » Wed Nov 17, 2010 9:05 pm

What you would need is a level variable added to the save group. So when you click to play the game, you would loadVars, and then depending on the level, load game.
Code: Select all
loadVars("savegroup","savegroup");
switch(level) // level is a variable in savegroup
{
    case 0:
    LoadGame("level0.ged");
    break;

    case 1:
    LoadGame("level1.ged");
    break;
   
    // etc
}


And when you complete a level, make sure to increase the level variable, and then saveVars.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Save Game

Postby Behdadsoft » Sat Nov 20, 2010 12:30 pm

Hello. Thank you for your help

I am a little confused, if possible, more about this script further explain or leave me a sample.

THANKS A LOT
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score

Re: Save Game

Postby schnellboot » Sat Nov 20, 2010 12:45 pm

you have used the sprites from 1945?
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Save Game

Postby Behdadsoft » Sat Nov 20, 2010 3:12 pm

What?
There is no possible way, if we found will make a way.

http://behdadsoft.com/
*******************************************************************
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0
User avatar
Behdadsoft
 
Posts: 207
Joined: Wed Dec 16, 2009 9:19 pm
Score: 2 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest