Lab 6 Write Up
Name: Zak "The Legend" Singh
Assignment:Scratch Lab #6
In Problem 1 we had to create an etch a sketch that would move and draw at the same time. If you press the spacebar it clears all the pen marks and goes back to 0,0.
In problem 2, we had to have a two buttons that change the speed of a sprite changing costumes. It would also have a max speed value that would record the fastest the sprite changed costumes.
Problem 1 Solution
For Problem 1, I had the program check if any arrow key was pressed and move the sprite in the corresponding directions. I also had it check if spacebar is pressed, which will move the sprite to 0,0 and erase all the pen "ink".
Problem 2 Solution
For problem 2, I had my program record the max speed by checking if the speed is over the max speed, and then set the max speed to the current speed if that is true.
- What is the difference between and if and and if-else statement?
- An if statement only does something if it's condition is met, but an if-else statement does something even if the condition is not meant.
- Is there a simpler way to write the following code? Explain.
- You could put the move 10 steps in a forever loop outside the conditional because it doesn't change from the conditional. Then you could just use an if command to say "My mouse is at zero!".
- Which students are described by the following conditional?
“if you are not a Senior and you are on the soccer team or you are in band then…”
- People who are not a senior and are part of the soccer team or band.
- If the statement from Question 3 is changed as shown below, who else is included in the condition?
“if you are not a Senior OR you are on the soccer team or you are in band then…”
- If you are not a senior then the condition is true. If you are on the soccer team or the band then the condition is also true. However, you dont have to meet both conditions for it to work.
- Write the condition for a number being a multiple of 15. (hint: look at the block).
- "If the number mod 15 = 0, then...." This would check if the number entered can be divided by 15 without a remainder. If it can, then it will do whatever is in the conditional.