4.1.6 Asking a question
Figure 109: Asking questions
This block allows you to ask a question and stores keyboard input in the answer block. The question appears in a voice balloon on the screen. The program waits as the user types in a response, presses the enter key or clicks the check mark.
Figure 110: Asking and responding to questions
Users can type the answer to a question. The example above shows the user answering a question.
Example:
The Sensing folder contains blocks of code that allow sprites to interact with each other. Select a sprite whose code allows it to cross the path of another sprite. Add the following code to this sprite:
Figure 111: Interaction between sprites
Please note that ‘Sprite5’, as referred to above example, is only used as an example and could be any other sprite of your choice. ‘Whirl’, the special effect used in the example above, will change the physical shape of the sprite. The higher the number, the greater the distortion to the sprite. But it is important to add to the block of code, after waiting one or two seconds, the additional block set whirl effect to 0 or clear graphics effects. Otherwise, the sprite will remain permanently distorted. The ‘whirl’ is only one special effect in this command block located within the Looks folder as shown below: experiment with these options and in changing the number in the set whirl effect to __ An Ambient Aquarium Sound. Finally, select suitable music to match the mood of slow-moving fish.