Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 784 Bytes

do_now_34.md

File metadata and controls

15 lines (8 loc) · 784 Bytes

Practice using arguments

Last class, you created a gravity block where a sprite would fall to the ground and stop when it touched a color. The sprite always falls at the same rate. How would we get the sprite to fall at different rates?

We will solve this problem by adding an argument to the gravity block. We can then pass the rate we want the sprite to move.

  1. Open your DoNow3.3 script with the gravity block.

  2. Add an argument named "rate" to the gravity block by clicking the "+" next to the block name.

  3. Change the move block to move "rate" spaces by dragging the rate variable to the move block.

  4. You can now pass different rates in your gravity block call located in the sprite's forever loop.

  5. Save your project as DoNow3.4.