Hi. I wanted to try a saving tutorial. If my sample here works, i will write a tutorial =]
i will be trying different codes for the next few days so.. hang on a little.
Well, apparently it is working so i guess i will write a tutorial =]
Ok, so get ready, that means, open up flash.
The first thing we want to do is think about what will be our variables, while my sample above has 2 variables, my RPG has more than 50, but the number of variables shouldn't be a problem.
So on the first frame, type this codes:
var savedgame = SharedObject.getLocal("mygamename");
_root.variable = savedgame.data.variable;
if (savedgame.data.age == undefined) {
_root.variable = undefined;
} else {
_root.gotoAndStop(3);
}
on the second frame, put stop (); on it's actions, and create a situation where your variable changes. Then create a button, place it wherever you want on the stage, and type this actions on it:
on (release) {
savedgame.data.variable = _root.variable;
savedgame.flush();
_root.gotoAndStop(3);
}
than, on the 3rd frame, just make a dynamic text box and type "variable" on var.
by doing this, you should be able to understand how saving works. There are more ways, specially with better versions of flash, and i might post them if i feel like it, but for now there is one very important thing you should know:
your game will NOT be saved if you use space in your game's name. So for example:
var savedgame = SharedObject.getLocal("my game name");
wouldn't work, that's because you are creating an internet temporarially file (cookie) and it won't accept spaces on it's index.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment