I have a game with four (4) frames. The rules are simple. You have to collect coins. I have huge problem with save my BESTSCORE and retrieve it in another frame. But first I would like to describe you my game structures.
I have global value -> “bestcoinscore”
FRAME 1 (START)
There is only one button – PLAY. When you press it -> Go to another frame “CHARACTER”
FRAME 2 (CHARACTER)
In this frame I have:
a) 2 counters ( first counter show current “coins” from game and second counter show best “coins” score. Counter called “currentcoins” and “bestcoins”)
b) Active object - > RETURN TO “ START” frame.
c) Ini object (best “coins” score is saving to this object)
d) 3 active object ( You can choose your character which you want to play. But on beginning you can choose only Character no. 1. If you want choose another character you need collect more money e.g
Character no. 1 – 0 coins
Character no. 2 – 20 coins to unlock
Character no. 3 – 50 coins to unlock
So, I need current value from “GAME” frame or “GAMEOVER” frame. If you collected 20 coins Character no. 2 will be unlock and so on.
Inside “CHARACTER” frame I have event : Always -> Retrieve value from global value “bestcoinscore” to counter “currentcoins”.
FRAME 3 (GAME)
This is game frame. Here you have to collect coins and destroy enemy. I have counter “gamecoins” in this frame. My events:
Always -> set global value “bestcoinscore” to counter “gamecoins”
If you loose game send you to “GAMEOVER” frame
FRAME 4 (GAMEOVER)
Here you can check your current score and best score (coins). I have ini object to save best score.
In this frame I have:
a) 2 counters ( first counter show current score (collected coins) from game and second counter show best score. Counter called “score” and “bestscore”)
b) Ini object to save best score
c) Active object -> RETURN TO START FRAME (if you press - > go to “START” frame)
d) Active object -> RESTART (Go to “GAME” frame)
My best score saving when you click on RETURN TO START FRAME button or RESTART button. I try set also START OF FRAME - > save -> bestscore and ALWAYS ->save->bestscore.
If I loose in game my bestscore is saving from counter “bestscore” (GAMEOVER frame). It’s works. My bestscore is send to global value “bestcoinscore”. It’s ok. After that when I loose and press RETURN TO START FRAME , and next I press “START” i can see there my bestscore (collected coins). It’s works very well.
If I loose in game and next I close my game (application) and after that start game again my bestcoin value is not saved in “ CHARACTER” frame but it’s saved on GAMEOVER frame. If I want see bestscore value in my “CHARACTER” frame a I have to go to GAMEOVER frame and next go back to “CHARACTER” frame.
My question is:
1. It is possible “retrieved” value from “GAMEOVER” frame and show this value in my “CHARACTER” frame ? ( I try with GLOBAL EVENTS but it’s not working) I would like to always set global values “bestcoinscore” from counter “bestscore” from “GAMEOVER” frame.
2. Maybe somebody know another , better methods to resolve my problem ?