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 Color Trail

Transcript

In this add-on, you’ll add a colorful trail effect to the racers. Here’s how this effect works. As the sprite moves forward, it creates clones of itself that change color then disappear.

Clones are copies of the sprite that you program to have a specific behavior or action.

First, select a player sprite. Open the “control” menu, and add a “create clone of myself” block into the repeat loop that makes the racer move forward.

Then, add a “when I start as a clone” block to the scripts editor. Any blocks you place after this block tell the clone what to do. Click the “looks” menu, and add a “change effect” block. To test this code, click the flag, then press the correct arrow key to move forward. Whoooaaaa! This is so awesome!! A bunch of clones appear, but they never disappear. To make them disappear, add a “delete this clone” block from the “control” menu after the “change effect” block.

Click the stop sign to clear the stage, then test the code again. No clones show up! After the clones are created, they change color and delete so fast, you can’t see them.

To fix this, add a “repeat” block around the “change effect” block. Test it out.

Nice! Since changing colors 10 times takes longer than changing colors once, you can see the trail effect. Tinker with the effect to make it your own.

Change the value in the “change effect” block to alter the color effect change. Add more “change effect” blocks to make the trail totally different.

This example shows what combining a “change color effect” and a “change pixelate effect” block creates.

This example combines “change color effect” and “change ghost effect.”

These are just some ideas. Come up with something totally unique for your game! Use this same method to add different trail effects to the other player sprite as well.

Now, it’s your turn! Create a clone when the player sprite moves forward using a “create clone of myself” block.

Make the clone repeat changing colors, then delete itself using “change effect,” “delete this clone,” and “repeat” blocks. Tinker with the effect to make it your own by adding more “change effect” blocks and modifying the values.

Add the same effect, or a completely different one, to the second player sprite.

Choose an Add-On
play_circle_filled
Change Up your Racetrack
Add a button that changes the racetrack backdrop.
arrow_forward
play_circle_filled
Costume Change
Change what the racers look like when a key is pressed.
arrow_forward
play_circle_filled
Step on the Gas (Part 1 of 2)
Change how fast the racers move, then make them slowdown on the grass.
arrow_forward
play_circle_filled
Step on the Gas (Part 2 of 2)
Change how fast the racers move, then make them slowdown on the grass.
arrow_forward
play_circle_filled
Crashing Sounds
Play a crashing sound each time the racers hit each other.
arrow_forward
play_circle_filled
Race Fans
Program a sprite to count down to the start of the race and cheer.
arrow_forward
play_circle_filled
Color Trail
Add a colorful trail effect to the racers.
arrow_forward
arrow_backward Back
Next arrow_forward
Instructions
  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!