Skip to main content
Participant
June 9, 2015
Question

external save files that a player can load in the game

  • June 9, 2015
  • 1 reply
  • 370 views

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.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 9, 2015

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

}

ArashiRyuAuthor
Participant
June 9, 2015

will players still be able to share their save file with other players using this method?

kglad
Community Expert
Community Expert
June 9, 2015

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).