Skip to content

Please update your browser

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

3. Customize the Projectile Sprite

Transcript

In this screencast, you'll look at the starter project code, then choose sound effects and costumes. The starter project gives you some code to begin with to save you some time in club today, though all the blocks used are ones you've learned before, so you could have built this yourself. You’ll get the chance to customize some of that starter code to make your project your own--watch this screencast to learn how to do it, then try it for yourself.

First, run the starter project and look at the code for the projectile sprite, the sprite that is going to bounce off your main character. The code reads: "When the flag is clicked, set the starting point for the projectile sprite on the right side of the screen. Then, forever move the projectile sprite to the left ten steps. If it hits the edge of the screen, then call the procedure “make noise.” Make noise doesn't do anything yet, because you need to add code for the sound (you will code for that in the next screencast). Next, a “glide” block sends the projectile sprite in a random direction and it changes into a different object by switching costumes--in this example, a doughnut or monkey. The loop then starts over: The projectile sprite moves to the right of the screen and heads toward the main character again. All this is accomplished by the starter code already included in your project, but you can customize it by adding the sounds and costumes you like for your projectile sprite. You already added a sprite to your project, but the projectile sprite is probably passing right by it, like you see here. To fix this, select the projectile sprite, then change the “touching” block drop-down to show the name of the sprite you added. Great! Now, when the projectile sprite hits the main character, it bounces away.

Next, click on the costumes tab. The code switches the costume of the bounce sprite to make it look like a totally different object each time it shows up onstage. You can see the costume switching here. Click the “choose costume from library” button to add two more costumes. You can delete the donut and the monkey and replace them them with different costumes, if you like. You should now have four total costumes.

Next, click the Sounds tab and choose four sounds the projectile sprite will make when it hits your main character. Make sure you still have the projectile sprite selected when you are choosing your sounds. Now, it's your turn. Change the “touching” block drop-down to the name of your main character sprite to make the projectile sprite bounce off the main character. Add two more costumes to the projectile sprite and add four sounds that you will use in the next screencast.

arrow_backward Back
Next arrow_forward
Instructions
  1. Look at the starter project code.
  2. Change the "touching" block on the projectile sprite to say the name of the sprite you previously added to your project.
  3. Add two more costumes to the projectile sprite.
  4. Add sounds for when the projectile sprite hits the main sprite.