Final Project: Haley and Amelia Clock

Story Board:

Open the Snap given to us, then we will import the special tools needed for this. We need to remember these blocks:

First we will edit the second hand since it will have to not only move the most but also make noise. We will give the command when green had is clicked, go to x=0 and y=0, so that it will be in the center of the clock. Next we will make a forever loop so that it will continue to move. Then we will add, point to (so that it will point outwards to a certain degree), then we will get a multiplication operator. For the seconds we will multiply the current second by 6 to get the number of degrees ( because there are 360 degrees in a circle and 60 seconds in a minute, 360/60=6).Next we will add a play sound block from sound and make it play the sound Tick by looking in the sound part of the snap menu.  Next we will add a wait of 1 second in to make it only move on the second instead of constantly moving, ticking and updating. For the minute hand we will do a similar process as before ( I will only address the changes made). So that it moves on the minute we will use point towards current minute*6 ( since there are also 60 minutes in an hour and 60*6=360). We will add a wait 60 seconds block in so that it will move on the minute. We also removed the sound since it only needs to play in seconds.Finally for the hour, we we will do a similar process to the minute process. The only differences are that hour hand will point to will be multiplied by 30 ( since there are 12 hours on a clock so 12*30=360) and the wait will be 3600 seconds so that it only moves on the hour.

Logic:

To figure out the degrees so that the sprites would point to their correct direction:

Seconds: Since there are 60 seconds in a minute and 360 degrees on a circle (clock), we must must multiply the seconds by 6 to get the proper degree (360/60=6).
Minutes: Since there are 60 minute in a hour and 360 degrees in a circle, we must multiply the current minute by 6 to make it point to the correct degree (360/60=6).

Hours: Since there are 12 hours on a clock and 360 degrees in a circle, we must multiply the current hour by 30 to make it point toward the correct degree (360/12=30).

Steps:

  1. With the three Sprites, create three different storyboards with similar blocks
  2. Use the “When green flag is clicked” block as the hat for each script
  3. To move all Sprites to the center, use the “move to x=0 and y=0” block
  4. Keep the x and y values as 0.
  5. Underneath that, use the “go to front” block that can be found in the Looks section
  6. For each script, use the forever bock to encase several blocks listed in the next few steps
  7. In the forever block, include the “Point in direction block”
  8. Place the multiplication operator in the white space
  9. For the hour hand, put 30 in the first space and an addition operator in the second
  10. Put current hour in the first space and a division operator in the second
  11. Put current minute in the numerator space and 60 in the denominator space
  12. For the minute hand, put 6 in the first space and the current minute block in the second
  13. For the second block, put 6 in the first space and the current second in the second
  14. For the minute hand, put the “wait” block after the point block and type in 60.
  15. The hour hand does not need a “wait” block.
  16. In the script for the second hand sprite, put the “Play Sounds” block underneath
  17. Select the sound “Tick”
  18. Underneath this, place the “wait” block and type in 1.
  19. Click the green flag to watch the clock run!

Problems and Solutions:

We could not find the Tick-Tock so we substituted the snapping sound.

We noticed looking at the clock that throughout the hour it moves gradually closer to the next hour instead of making a jump from 9 to 10 and 10:00. At first we were stumped on how to fix this, then we realized that we need to use more operators to change the position throughout the hour of the hour hand. First we knew we needed to incorperate minutes somehow so we knew we needed to convert between minutes and hours so we used the divide operator to convert the current minute into hour ( 60 minutes=1 hour) so current minute/60. This will create the fraction of the hour. Then we knew we needed to add this to the hour so we added the addition opperator, so it became current hour+ current minute/60. Next we knew it still needed to point in the correct direction and since it was still in hours we put it all inside the multiplication opperator such that 30(current hour+ current minute/60) thus is will point towards the correct direction. Finally we realized that we didn’t actually need the wait of 3600 seconds since it wasn’t actually making a noise so we removed that allowing it to move throughout the hour and deleting unnessisary code.

Future reference:

Through this lab, we learned several skills that we can apply to future labs. For example, we now know that operator blocks can be used to specify the exact direction we want the Sprite to go or point. This is especially helpful when mathematical processes are required to successfully complete the task. Also, by inputting identical coordinates for each Sprite, they will all go to the same location on the background.

Link:

https://snap.berkeley.edu/snapsource/snap.html#present:Username=ameliafaison&ProjectName=BuildYourOwnClock_Student

Leave a comment