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 Power/Receiver Speed

Transcript

In this add on you'll add a feature to your project that lets the user adjust the passing power and the speed of the receivers.

To make the balls make the ball sprites and the receiver sprites move faster or slower.

You will use variables with slider controls to complete this add on.

Select the ball sprite to start.

The value space in the move block contains the number that determines that how fast the ball moves.

It contains the number 10.

So each time the loop runs, the sprite runs 10 steps.

To vary this number, use a variable.

Click "make a variable".

Computer store changing information in variables.

Name the variable "power".

And click "ok" This added a bunch of new blocks for you to use.

Drag the power variable out and snap it into the move block.

Next, to change the variable with a slider.

Check the box next to the variable.

The variable will appear on stage but just as a number.

Double click it one or two times till a slider appears.

Test it out now.

Move the slider then hit the space bar.

Move it again.

Pass again.

Isn't that pretty neat?

The slider changes the speed of the ball sprite.

Okay, next you'll do the same with the receivers.

Click "make a variable" again.

And name this one "speed".

Click "ok" to make this new variable.

Then, for each of you receiver sprites drag the new variable into the move block of the beginning of the forever loop.

Show the speed variable by checking its box.

Then double click it on the stage until it becomes a slider.

Great.

Test again.

Click the flag adjust the new slider to see the receiver speed up and slow down.

That might be a little too fast.

Alright, here's the game plan.

Create new variables called power and speed.

Place them into the correct move blocks.

Then, create a slider on the stage that lets the user adjust the power and speed.

Choose an Add-On
Never Ending Game
Make the receivers disappear and regenerate each time you pass to them.
Passing Back
The ball will always bounce back to the starting position.
Power/Receiver Speed
Add realistic variables with sliders that control the speed of the ball and the receiver sprites.
Keep Score
Count how many passes you complete.
arrow_backward Back
Next arrow_forward
Instructions
  1. Watch the introductory video.
  2. Scroll down to see the add-on choices.
  3. Select an add-on and start creating!
  4. Choose another add-on, and continue building.