Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Make Some Magic


In this add-on, you'll add some fun effects to your music video by making your sprite grow up in the corner of the screen and leaving a trail.

(upbeat music)

Click on your sprite.

This example uses a shark, but you can use any sprite you like.

And go to the More Blocks menu.

Click Make a Block, and name the new block Magic.

Naming the block Magic won't make it do anything.

Need to add code to the define Magic stack to tell the computer what it should do when the block is run.

You need to add several blocks to Magic to define it.

This effect involves several steps.

It's easier if you break it down into three parts that define what you want the sprite to do.

Grow, move, and stamp copies of itself to look like a trail.

Then build the code to accomplish each step.

In this example, the code changes the sprite size by 10, making it a little bigger.

Then, it moves to the right 10 steps, and then up 10 steps.

Finally, it stamps a copy of the sprite.

The code is inside a repeat 15 loop so it will perform each of the steps 15 times.

Take one of the dividers in the blocks to change how many times the sprite stamped itself, until you come up with the right effect for your program.

Test your code.

Cool, the sprite grows and leaves a trail.

But if you click the code stack again, the sprite grows even bigger and goes off the stage.

You want the sprite to grow from small to large and leave a trail many times during a song so you need to add code that returns the sprite to its original position and size.

Getting a character in your music video to perform several different behaviors at once like that is pretty complex.

The easiest way to approach a multipart problem like this is to break it down into smaller pieces.

For example, build a code that makes your sprite move and grow first, then build a code that clears the stage and resets the sprite to it's original position and size.

Finally, create code that tells your sprite where to start over again.

You created and defined a Magic block, but now you need to tell the computer when to run it.

Add a one flag clickblock and a forever loop if your sprite doesn't already have one.

Then, use the Magic block with a Weight block or other blocks to make the Magic happen when your program is run.

(upbeat music)

Now it's your turn.

Add or choose a sprite that will grow and leave a trail.

Make a block called Magic and add code to define that block.

Then use a When flag, click to fit and a forever loop to add this cool effect to your music video.

Choose an Add-On
Dizzy Sprite
In this add-on, you will make a spinning sprite.
Color Change
In this add-on, you create cool color change effects.
Bounce Around
In this add-on, you will create a block that programs your sprite to bounce around the stage.
Dance Fever
In this add-on, you will give your sprite some dance moves.
Make Some Magic
In this add-on, you will create some sprite magic.
In this add-on, you will add a sprite with cool movement effects to appear and hide on the stage.
Background Change
In this add-on, you will switch up the background.
arrow_backward Back
Next arrow_forward
  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!