
Frogs, Cannonballs, and Flying Fruit, Part 1
1. It’s time to start throwing things: frogs, cannonballs, flying fruit. The trajectory of flying objects is ruled by an equation called a
parabola. In its simplest form, a parabola looks like this:
y = ax
2
and has a shape like this:
a is a coefficient that tells you the shape of the parabola. If a is negative, the parabola will go up and then down (like the trajectory
of a rock you throw in the air). If a is positive, the parabola will go down and then up, like the shape of a chain hung between two
posts. If a has a small absolute value (is close to 0), the parabola will be flatter. If a has a large absolute value (is far from 0), the
parabola will be steeper.
2. Create a new project and name it “Frogs, Cannonballs, and Flying Fruit”.
3. Change the first costume of Sprite1 to something you want to fly through the air: a frog, a cannonball, a piece of fruit, etc. Change
the second costume to what that object looks like when it lands: a frog, an explosion, a piece of splattered fruit.
4. Drag a when green flag clicked block onto the scripts area, add clear and pen up blocks from Pen, and add a switch costume to
costume1 block from Looks.
5. Create two variables named x and y. Set x to -40 and y to -.05*x*x. Add a block to move to (x, y).
6. Add a pen down block from Pen.
7. Add a repeat 20 block. Inside it, add blocks to change x by 4, set y to -.05*x*x and move to (x, y).
8. After the repeat 20 block, add a switch costume to costume2 block.
9. Click the green flag. If you have ever played a video game in which characters jump or are shot through the air (think Angry
Birds), the motion should be familiar to you.
10. Save your project.
Comentarios a estos manuales