Heres my code:
function savegame(){
myLSO = SharedObject.getLocal("Xin_Chapter1");
if(myLSO.data.myObj == undefined){ // No object exists
trace("Saved Game");
}
else{
trace("Overwrote Saved Game");
}
myObj = {};
myObj.objArray = new Array();
myObj.objArray[0] = hp;
myObj.objArray[1] = mp;
myObj.objArray[2] = maxhp;
myObj.objArray[3] = maxmp;
myObj.objArray[4] = atk;
myObj.objArray[5] = def;
myObj.objArray[6] = sp;
myObj.objArray[7] = maxsp;
myObj.objArray[8] = xp;
myObj.objArray[9] = maxxp;
myObj.objArray[10] = maxatk
myLSO.data.myObj = myObj;
}
function loadgame(){
myLSO = SharedObject.getLocal("Xin_Chapter1");
if(myLSO.data.myObj == undefined){ // No object exists
trace("No Saved Game");
}
else{
trace("Loaded Game");
hp = myLSO.data.myObj.objArray[0];
mp = myLSO.data.myObj.objArray[1];
maxhp = myLSO.data.myObj.objArray[2];
maxmp = myLSO.data.myObj.objArray[3];
atk = myLSO.data.myObj.objArray[4];
def = myLSO.data.myObj.objArray[5];
sp = myLSO.data.myObj.objArray[6];
maxsp = myLSO.data.myObj.objArray[7];
xp = myLSO.data.myObj.objArray[8];
maxxp= myLSO.data.myObj.objArray[9];
maxatk=myLSO.data.myObj.objArray[10];
}
}
My question is I used to have all the variables (atk, def, hp, sp, etc.) as _root. type variables, I have changed them to _global. variables so I could have a movieclip with the dynamic text inside it. Okay so the real question is: would I have to change any of the code in any of the functions because of this? Thanks
OFF TOPIC:
would it be possible to do this?
- make dynamic text
- put the variable health in the variable box
- put this code on the frame:_root.health.text=_global.hp
Would it be possible to do that? Thanks again