Hey everyone so been at this for a couple hours now and cant seem to figure it out.
So I have a Shared Object Data variable sharedObjectStarsPoints
that is used to keep track of the number of stars that a player unlocks in a game.
So what I am trying to accomplish is say the player has unlocked 2 stars and retrys the level again but this time the player gets only 1 star I want the shared Object to ignore the player only getting the 1 star and keep the highest number of stars in the data base in this example that number would be 2. Player can get total of 3 stars.
So when the player loses it takes them to the game over screen which is where I remove all the ENTER FRAME listeners and everything else. This is also where I setup how many stars the player unlocked and try to use the logic from above to compare the two numbers like so:
so in the same function this is when the variable starsCollected
is incremented.
if (bJanObjecMult)
{
objectiveScreen.janStars.bonus.gotoAndPlay(2);
//add 1 to star collector number
starsCollected += 1;
//Add one to levels screen stars completed
updateStarsCollected();
}else
{
objectiveScreen.janStars.bonus.gotoAndStop(1);
}
if (bJanObjectPoints)
{
objectiveScreen.janStars.points.gotoAndPlay(2);
//add 1 to star collector number
starsCollected += 1;
//Add one to levels screen stars completed
updateStarsCollected();
}
then below these if statements are where I try to use the logic like so:
if (sharedObjectStarsPoints.data.janStars > starsCollected)
{
trace("DONT SAVE DATA");
}else
{
sharedObjectStarsPoints.data.janStars = starsCollected;
allSharedObjectStarsData();
sharedObjectStarsPoints.flush();
trace("SAVE DATA");
}
so as you can see I am basically saying if my shared object data is greater than the stars collected data, then dont save anything because say the shared data has 2 and the other data only has 1 then I dont want anything to be replaced. But if that is not the case and its less than the starsCollected data then save the new information and update it.
Also to note whenever the player restars the game the starsCollected
number var is set back to 0;
please any help would be appreciated!