You are currently using an older browser. Please update to the latest browser to ensure features and pages work properly. Learn more
We are currently experiencing issues with new student accounts. If you are unable to create an account, you can still access the activity videos without signing in. We apologize for the inconvenience. Check updates
4. Smooth Wave
In this video,you'll smooth out your wave animationso the waves move more gradually.
Right now when you run your program,the wave changes effect by 25, waits, then changes back.
To make the waves move more gradually,program them to change in smaller amounts.
You could write a lot of code to do this,change effect by five, change effect by five,wait, and so on to make the wave move a little bitat a time, but as you saw in the last video,it's easier to program the computerto repeat these actions for you.
To do this, drag out a repeat 10 block.
While the forever loop you used beforemakes an action repeat for the whole program,the repeat 10 block only runs a specified number of times.
Place change whirl effect and wave blocksinside the repeat 10 block.
Tinker with the values of the change whirl effect,wait, and repeat blocks until the water lookslike a smooth natural wave.
As you test your program,if you need to reset the whirl effect to zero,click the Looks menuand the clear graphic effects block.
Once your wave looks good to you,put the repeat block back in the forever loop.
Then, do the same for the other change whirl effectand wait blocks.
Drag out a repeat 10 block,and place the blocks inside it.
Keep your wave from going too far in one directionby entering the same values in the repeat and wave blocks.
Then, use a negative value in the change whirl effect block.
Place this code back inside the forever loopand click the flag to run it.
When the flag is clicked, the forever loop beginsto run the code inside.
First, it runs the repeat block.
This repeats changing the effect and waiting 10 times.
Then, the next repeat block runs.
When that finishes, the whole process starts over again.
Awesome, you should have a smooth looking wave.
In the next video, you'll add more spritesand begin telling a storyabout what's happening on this boat.
Now it's your turn.
Add a repeat block around each pairof change effect and wait blocks.
Change the values of the blocksto create a smooth wave effect for your program.
Add a “repeat” block around each pair of “change effect” and “wait” blocks.
Change the values of the blocks to create a smooth wave effect for your program.