jump

Report 0 Downloads 281 Views
Scratch Lessons:

Jumping and Platforms 1. Now that both our backgrounds and character move, it’s time to program our character to jump. There are many ways to do this, but in our method we will begin by painting the bottom of our character’s feet red. You must do this for each costume.

A

B

Click “Costumes”, then “Edit” for “costume 1”.

Use the paintbrush to paint the bottom of your character’s shoe red.

1

Continue to paint each costume with red feet.

C

2. Next, you’ll create a yellow ground for your character to walk on.

A

2

3. Click “Zoom out”. A

B

Use the Line Tool to create a yellow line at the bottom of the screen.

3

C

Move the yellow line to the bottom of the stage.

4. Now, write code that says if the red on your character’s shoes is not touching the yellow of the ground, drop down. Remember “Y” is up (+) and down (-) in Scratch. So have the “Y” of your character change by -3 when it’s not touching yellow. A

4

B

5. Next, create some platforms (steps) for your character to jump onto. Begin by clicking “Paint new sprite”. A

5

B

C

Paint some yellow platforms using the line tool. Click “OK”.

Make sure the yellow platforms are always in front.

6

6. You want the platforms you just created to appear when the first background appears--not on all the backgrounds. Therefore drag the code on the first background on top of the platfoms you just created. A

Click on your first background and drag the whole block of code onto your first platforms.

Drag the whole block of code

* Repeat steps 5 and 6 for more platforms, except drag the code from your next background onto your next set of platforms. For example, for your second set of platforms, drag the code from your second background onto it:

7

7. Finally, write the code for your character to jump.

A

8

8. Once your are finished, the code on your character should look something like this:

9