At the moment, the character sprite just says yes! :)
or no :(
to the player’s answers. Add some graphics to let the player know whether their answer is correct or incorrect.
Create a new sprite called ‘Result’, and give it a ‘tick/check’ and a ‘cross’ costume.
Change your character sprite’s code so that, instead of saying something to the player, it broadcasts
the messages ‘correct’ or ‘wrong’.
Now you can use these messages to show
the ‘tick’ or ‘cross’ costume. Add the following code to the ‘Result’ sprite:
Test your game again. You should see the tick whenever you answer a question correctly, and the cross whenever you answer incorrectly!
Can you see that the code for when I receive correct
and
is nearly identical?when I receive wrong
So you can change your code more easily, you are going to create a custom block.
Select the ‘Result’ sprite. Then click on My Blocks
, and then on Make a Block. Create a new block and call it animate
.
Move the code to show
and hide
the ‘Result’ sprite into the
block:animate
Make sure you have removed the
and show
blocks below both of the hide
switch costume
blocks.
Then add the
block below both of the animate
blocks. Your code should now look like this:switch costume
Because of the custom
block, you now only need to make one change to your code if you want to show the ‘Result’ sprite’s costumes a longer or shorter time.animate
Change your code so that the ‘tick’ or ‘cross’ costumes display for 2 seconds.
Instead of
and showing
the ‘tick’ or ‘cross’ costumes, you could change your hiding
block so that the costumes fade in.animate
Can you improve the animation of the ‘tick’ or ‘cross’ graphics? You could add code to make the costumes fade out as well, or you could use other cool effects: