Saving is an essential part of a large game. It will keep the player coming back to your game to replay, instead of quitting because they cannot take playing anymore. This is what you will be making. Here is how to make a save button:

  1. On the first frame of your game, put this code: var savefile = SharedObject.getLocal(“nameOfYourGame”);
  2. Next, you’ll need to make a button for saving.
  3. Now, put this code onto the button: on (press){//when the button is pressed
    savefile.data.levelNumber=_root.level;//save the variable levelNumber
    savefile.data.anything=_root.anything;//save the variable anything
    savefile.flush();//saves it as a cookie
    }
  4. You’ll be needing a load button now, so make one and put this code onto it:                                       on (press){//when the button is pressed
    if(savefile.data.levelNumber==undefined){//if there is no save file
    _root.levelNumber=1;//the level will equal 1
    }else{//otherwise
    _root.level=savefile.data.levelNumber;//the level equals the number that was saved
    }
    }
  5. There you go, you can save booleans too (I just chose not to). That’s all the steps of making a save and load button. You can use it for many different types of games. Use it well.

Related posts:

  1. How to Make a Button in Flash
  2. 5 Things to Avoid when Making a Game
  3. What you should Know about making Game Sequels