-
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.
Code:
on(release){
savefile.data.levelnum= _root.levelnum;
savefile.flush();
}
And the load button code is.
Code:
on(release){
var savefile = SharedObject.getLocal("test");
_root.levelnum = savefile.data.levelnum;
}
if (savefile.data.levelnum == undefined ){
_root.gotoAndStop("level1")
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.
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|