SCRATCH GOLD II
SCRATCH GOLD I
2 of 3

3.07 Add graphics

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.

Sprite with tick and cross costumes

Change your character sprite’s code so that, instead of saying something to the player, it broadcasts the messages ‘correct’ or ‘wrong’.

Character sprite

Now you can use these messages to show the ‘tick’ or ‘cross’ costume. Add the following code to the ‘Result’ sprite:

Result sprite

Test your game again. You should see the tick whenever you answer a question correctly, and the cross whenever you answer incorrectly!

Tick for correct, cross for wrong answer

Can you see that the code for when I receive correct and when I receive wrong is nearly identical?

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.

Result sprite
Create a block called animate

Move the code to show and hide the ‘Result’ sprite into the animate block:

Result sprite

Make sure you have removed the show and hide blocks below both of the switch costume blocks.

Then add the animate block below both of the switch costume blocks. Your code should now look like this:

Result sprite

Because of the custom animate 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.

Change your code so that the ‘tick’ or ‘cross’ costumes display for 2 seconds.

Instead of showing and hiding the ‘tick’ or ‘cross’ costumes, you could change your animate block so that the costumes fade in.

Result sprite

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:

screenshot

×
×

Cart