A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Saving and loading a game idea

  1. #1
    Junior Member
    Join Date
    May 2010

    Lightbulb Saving and loading a game idea

    Ok well.... my idea here is to have a save button that saves you data, or an auto save function either one. Then when you start your game, have a load button that loads the data and takes you to the corresponding level.

    For the save button code I have this.
    savefile.data.levelnum= _root.levelnum;
    And the load button code is.

    var savefile = SharedObject.getLocal("test");
    _root.levelnum = savefile.data.levelnum;
    if (savefile.data.levelnum == undefined ){ 
    Now the only problem with this is I don't know how to actually implement it. For instance it saving the levelnum equal to 4 then when it loads having it go to the fourth level.

  2. #2
    I'm not sure where exactly you're having the problem. It seems like you've got everything you need.

    You could put the save and load things into functions, maybe? save_data() and load_data(). Execute save_data() at the end of a level and load_data() when you push the button.

    Or do you mean the act of jumping to a given level in general? If that's the case, it's a lot more open-ended and depends on whether you're using Flash IDE or Flex or something. How much game have you made so far?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center