Next Fruit Function
All fruits are made from combinations of the first four:
All fruits are made from combinations of the first four:
Cherry, Lemon, Orange, Tomato
Cherry, Lemon, Orange, Tomato
So the cursor should randomly position itself above one of those
So the cursor should randomly position itself above one of those
to determine which is the next fruit to drop
to determine which is the next fruit to drop
Create two global variables: nextFruit and randomNum
Create two global variables: nextFruit and randomNum
Create a new group called Functions
Create a new group called Functions
Create a function called SelectNextFruit which will determine the fruit which will spawn next
Create a function called SelectNextFruit which will determine the fruit which will spawn next
When the function runs we generate a random number between 0 and 4 and store it in nextFruit
When the function runs we generate a random number between 0 and 4 and store it in nextFruit
Then move the cursor over the fruit whose animation frame matches the random number generated.
Then move the cursor over the fruit whose animation frame matches the random number generated.
We tween the motion on the X access to make it move more smoothly.
We tween the motion on the X access to make it move more smoothly.
You have to call this function when you drop a fruit. Update the Controls group as shown.
You have to call this function when you drop a fruit. Update the Controls group as shown.
When fruits are in the field of play we should mark them as ACTIVE
When fruits are in the field of play we should mark them as ACTIVE