File autosaves after save it [SOLVED]

7 posts

Flag Post

Well. I´ve got a file wich shows in screen a ball, a bunch of spikes and 3 coins. If the ball touchs the spikes, the screen go to game over and it saves the coins gotten. Then, if you press the retry button and got any coin, that coin also save it, even if before don’t touch the spikes. I don’t know why.
Press here to try my test file.

The small blue ball resets the data.

 
Flag Post

What I said here could be the problem. Otherwise, I don’t know what it is.

 
Flag Post

Yes, i saw it, feartehstickman. But it still not works….

 
Flag Post

Something I doing wrong.

 
Flag Post

Nobody knows the fix? I explain another time:

If you take a coin and afterwards touch the spikes, the game saves the score and removes the taken coin. If then you press the retry button, the game restart, but the taken coin isn’t show on screen and the score shows 1.
At that point all works fine.
But if in that moment you take another coin, and you refresh the page (close and reopen the file in my case), the new taken coin isn’t on screen and score is too wrong.

Cheers.

 
Flag Post

When you close the game, flush() is called automatically. So when you put stuff temporarily in a SharedObject file (which you do), it will be saved when the game is closed.

It doesn’t do that on the first load because you don’t create the variables in the SO to save to until the player is killed by the spikes.

 
Flag Post

Solved with splice metod:

myArray1 = mySO.data.mySavedArray1.slice();

and

mySO.data.mySavedArray1 = myArray1.slice();

Thank you everyone ;)