Step 6: Creating apples to represent the denominator
In this final step we will check how many more denominator apples need to be created, and then create them semi-transparently.
First we'll modify the top "if" block to turn it into an "if-else" block. Click on the cog icon on the "if" block, and drag the "else" block into the right.
Since we want to create more apples for the denominator, we can duplicate all the blocks we are already using to create apples for the numerator. Duplicate the "if-else" block (by right-clicking on it) and drag the duplicated blocks into the "else" section.
These duplicated blocks will need to be tweaked a little bit to make them work for the denominator.
In the duplicated blocks, change "numerator counter" to "denominator counter".
Now we'll add in a block to make the denominator apples go semi-transparent. Grab "set alpha of myself" (from Looks) and drag it under the duplicate "create new instance" block.
Drag "myself" into the trash, and replace it with "instance instance". Also set the alpha number to 0.3.
Now let's play the game to see if it works as expected.
We can see the last apple is still not semi-transparent. This is because it is our first apple that we've made step across the screen. We can simply remove it by using the "destroy" block.
Grab the "destroy myself" block (from Control Flow) and drag it into the bottom "else" section. Drag the "myself" block into the trash, and replace it with "first instance by tag apple".
Now play the game again to see the final version.
Great work! Don't forget to save your game when you're done.