Lab Write Up 6
Name: Cameron Beattie
Assignment: Lab #6
This problem focused on using variables to increase or decrease the the speed at which a sprite changes costumes.
I made 2 sprites, one that said "faster" and one that said "slower". I used a "speed" variable in combination with an operator to double the speed when clicking on the faster sprite, and reduce the speed by half when clicking on the slower sprite. Then I used an operator and a "speedX" variable too set the max speed to the current speed whenever the current speed became larger than the max speed.
This problem focused on using conditionals to create movement with the arrow keys, and then using the pen tool to draw on the stage.
I had the sprite put the pen down first. I used an "if" statement inside a forever loop and I had it sense when it was pressing an arrow key. If an arrow key was being pressed, then it would move in the direction of that arrow key. Lastly I had the sprite return to the center and clear all pen marks when the space key is pressed.
- What is the difference between and if and and if-else statement?
- "If" statements have a condition and an effect, "if-else" statements have a condition and an effect as well as an alternative effect if the condition is not true.
- Is there a simpler way to write the following code? Explain.
- Yes, it could be writen with just the "say" command inside the "if" statement and no "else" statement. Then put the "move" command after the if statement.
- 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…”
- Juniors, Sophomores, and Freshmen who are in band and Juniors, Sophomores, and Freshmen who are on the soccer team.
- 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…”
- It would include all juniors, sophomores, and freshmen as well as anny seniors who are in band or on the soccer team.
- Write the condition for a number being a multiple of 15.
- If Xmod15=0, then the number is a multiple of 15.