Time for action – selecting a random fortune
We're going to use a separate stack of blocks to handle the script to issue a fortune. The steps are as follows:
- With the teller sprite selected, add a when I receive (fortune) block to the scripts area. Attach a say () for () secs block.
- From the Data palette, drag the item () of () block into the first value of the say block. Select random for the position value and answers from the available lists.
- Test the program by clicking on the seeker sprite. If all goes well, you will receive an answer (that is, a fortune) in response to your question. If your seeker repeats the question, you can remove the say block we used as a debug step in the previous exercise. The following screenshot shows our sample script so far.
What just happened?
We'll pause here for a brief moment, so you can reflect on your future life as a physic in the carnival. Our game framework is complete in that we have everything we need to ask a question and receive...