Week 6-11/22

I am going to be posting a lot of code over next few day. The best thing to do is to try to understand how each program works before going on to the next one.  Feel free to email me for help.

A. See link :    http://scratch.mit.edu/projects/35818966/

Try to understand how the code works. Look at the yVolocity variable. See how it changes. Think about why I have a forever loop that is never going to terminate (exit).  Notice what happens when “key a” is pressed.  What happens when “key a” is pressed and then pressed again? Change the initialization of yVolocity from 10 to something else. See if you can write the code so the the butterfly does not go through the block (I will be posting that tomorrow so try to do it yourself before looking at answer).

B See link:   http://scratch.mit.edu/projects/35994486/

Start the game and then hit the key s.  I used “s” for stop. Try to understand how this works. Look at code from part A and see the changes I made to part B. (Hint: I replaced forever loops with repeat until loops, why?)

C See link http://scratch.mit.edu/projects/36065712/

Start the game and jump so that you hit the yellow block.  Notice the bytterfly bounces down. See if you can figure out how the changes to the code made that happen.

 

D: Notice in the code above when the butterfly jumps and hits its head on the block it bounces down. This is good but it then goes to low. Can you figure out how to make it stop falling so that it stops and is fully in the display?

 

More to follow in next few days

 

 

One thought on “Week 6-11/22”

Leave a Reply