ICM WK4 Modularity

This week, I continued to work on the previous assignment- bowling animation from WK2 and made 3 changes.

1) The weekly assignment is to clean up draw function by making up new functions, reorganizing functions so it is more manageable  and easier to go back to in case you have a issue. So 1st change I made is reorganize everything into three big parts — displayBall(), moveball(), displayPin().

 Screen Shot 2014-09-30 at 1.04.06 AM

2) Before, animation starts running as soon as you hit the run button, and it would not go back to point zero by itself. So, the 2nd change I made is to add a boolean, and the animation will not start until I call it by pressing the DOWN arrow key, and UP arrow key to stop the animation.  (*A new function I learned this week is KEYCODE)

3) Before, the ball can only move from top to the bottom part of the screen. There is room for improvement. So the 3rd change I made is the variables of the ball– when you move finger on the trackpad, the ball will move with you.

The biggest challenge is still boolean. I spent almost two hours to rewrite, retest, and re-watch the video and re-read the note.

To recap, press DOWN arrow key to start, move your finger on trackpad to move the ball, press the DOWN array key to stop the animation.

 

Screen Shot 2014-09-30 at 1.07.52 AM

Screen Shot 2014-09-30 at 1.08.20 AM

Screen Shot 2014-09-30 at 1.08.47 AM

Screen Shot 2014-09-30 at 1.09.33 AM

Screen Shot 2014-09-30 at 1.10.39 AM

 

Leave a Reply