Copy link to clipboard
Copied
I am making a V-pet like game and I want my flash game to create a .txt file when the player saves his pet and can access it again at any time to battle against it. the saved information is its name,race,age,size,hunger level,happiness level,its rank and its state(asleep,hurt,etc) age,size and health will be Number var and the rest will be String var
any idea on how to make this? I plan to distribute the first prototype on a dedicated facebook page as soon as I get a basic race rooster and the save mechanic done so any help on making the saving system will be great.
Copy link to clipboard
Copied
it's easier to use a non-text file called a sharedobject. that will also prevent players from 'hacking' your game.
var so:SharedObject=SharedObject.getLocal('pet_game','/');
if(so.data['your_pet_name']){
// this pet exists assign its characteristics from the saved data
} else {
// no such pet exists. do whatever.
}
// when a player is ready to save their pet, call saveF passing the pet's name
function saveF(pet_nameS:String):void{
so.data[pet_nameS]={};
so.data[pet_nameS].race=
so.data[pet_nameS].age=
etc
}
Copy link to clipboard
Copied
will players still be able to share their save file with other players using this method?
Copy link to clipboard
Copied
no, not easily.
if you want to save a text file so users can edit/share etc, use the filereference class to (or file class if you're creating an air app).
Copy link to clipboard
Copied
could you point me to a site where I could learn how to work with classes? I got flash cc a week ago so im kinda n00b in the program
Copy link to clipboard
Copied
you don't need to use class file structure to use a flash class, though learning how to work with classes is a good idea, Learning ActionScript 3 | Adobe Developer Connection
here's the api to learn how to use the filereference class, Adobe ActionScript® 3 (AS3) API Reference
Copy link to clipboard
Copied
thanks a lot man
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now