In this add-on, you'll program a bonus sprite to give the player bonus points when it's caught.

First, add a bonus sprite.

This example uses the Apple sprite, but you can select whatever you would like.

Program the sprite to hide when the game starts using a When Flag Clicked event and a Hide block.

To make this sprite appear at random times, use a conditional statement.

Place an Equals operator in the If portion of the block.

On the left side, add a Pick Random block.

And in the right side, type 10.

In the Then portion, add a Show block.

The code says, pick a random number between one and 10, and if the number is 10, then show the sprite.

Click the flag a few times to test.

Awesome, the sprite shows randomly.

To make the sprite glide to the other side of the screen, then hide after it shows, add a Glide and a Hide block.

Click the flag a few more times to test.

Great, make the sprite continuously hide then randomly show by adding a Forever loop around the code.

Tinker with the values in the Pick Random, Equals, and Glide blocks until you get an effect you like.

There's a bug in the program.

The bonus sprite is blinking on the other end of the stage because it keeps gliding to the same spot.

To program the apple to start at a different spot, add a Go To X-Y block after the Hide block, and at the beginning of the program.

Click the flag to test.

Great, that fixed the bug.

Next, program the player to receive points if it touches the bonus sprite.

Select the Player sprite, and add an If block.

Inside this, place a Touching block.

Click the drop-down and select the name of the bonus sprite.

To increase the score when the player sprite touches the bonus sprite, add a Change score block.

Tinker with the value in the block.

This example uses a value of five.

Test your code.

Cool, when the player sprite touches the bonus sprite, the score increases.

To make the game even more challenging, set the bonus sprite to a random Y position.

Create a variable called Y Position.

Under the Show Block, place a said Y Position block.

Inside this, add a Pick Random block.

Type values into the Pick Random block.

This example uses negative 200 and positive 200, but you can use any values you'd like.

To program the sprite to go to our random Y location, add a Y position block to the Why value of the Go To X-Y block at the bottom of the code stack.


Now it's your turn.

Add a bonus sprite, program the bonus sprite to randomly show, then start at one end of the stage and glide to the other.

Program the score to increase if the player sprite touches the bonus sprite.

Choose an Add-On

Finish Line Cheer

Program a sound to play if the player touches the finish line.

Play with a Friend Option 1

Add a second player to the game.

Play with a Friend option 2

Challenge a friend by having them control the enemies.

Shrinking Finish-Line

Program the finish line to get smaller as the player scores more points.

Bonus Points!

Create a sprite that, when touched, gives the player extra points.


  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!
  • The song “Magic Marker” is © YouTube-- CC-BY-SA 4.0 does not apply.