-
You created all the parts for this app to work! Let's use these parts to make the app fun.
-
To control the app, all this screen needs to do is check what screen just closed. So, drag the
when [Screen1].OtherScreenClosedblock from Screen1 onto the Viewer. -
When a minigame closes it results in a value. You can get this value inside the
when [Screen].OtherScreenClosedblock. -
To keep track of the player's score, you can use the
initialize global [name] toblock (in Variables). Change "name" to "score" so it's easy to remember. Drag the[0]block from math onto theinitialize global [score] toblock. Here's what it should look like: -
Drag the
if thenblock with this symbol
out. Click the symbol and drag two else ifblocks over so it looks like this:
-
The first thing to check is whether a minigame closed or it was the home screen that closed. Use the
[] = []block from Logic. Check if theresultequals the text "HomeScreen"- Note: Remember, you added this block at the start but then disabled it. Enable it again so that the home screen will close with the result "HomeScreen".
-
For the
thenpart you want to play a minigame, because the only way the player got to Screen1 from the home screen was pressing the play button. Remember the procedure you created? openMinigame? You can use that now. In Procedures there will now be acall [openMinigame]block, use that! You also need to use theset [global score] toblock to 0, so the game resets the players score! Make sure everything in your blocks looks right: -
The two
else if's will check if the player won the last game or not. Remember when a minigame closes it results in the Text "won" or "lost". If they won, the app should add 1 to the player's score and open another minigame. You can use the[] + []block from Math and the score variable to add 1. -
If they lost, it saves their score to the file and opens the home screen. To add the score to the player file use the
call File1.AppendToFileblock (from File1). After the score is saved, open the home screen. Here's how the blocks look: -
You can try the app out now, but the score won't be working... You'll fix that on the next card!



