Name: Shreya Raj
Assignment: Lab #4
This Scratch Lab focused on using variables. The lab made students really understand variables by experimenting with variables and making students create new variables for their sprites. By creating variables you were asked to complete specific problems to help further understanding. For example using variables in animations to control different aspects of the animation. The variable could control volume, speed, or it could be even more interactive with the person watching the animation by asking questions to the viewer. Click HERE to get to the lab instructions.
For this problem you were told to create a simple animation with the ability to change the speed of the animation by clicking 2 different sprites. This involved creating a variable called speed. My solution involved a simple animation of a costume change for my main sprite and I included two other sprites that look like buttons to help change the speed variable. I set the speed variable to 0.2 seconds, and added the “when this sprite clicked” command to my button sprites to control the speed. For the “faster” button, I gave the command that when this sprite was clicked the variable, speed, would change by -0.2 seconds. For the “slower” button, I gave the command that when this sprite was clicked then the variable, speed, would change by 0.2 seconds. This would cause the speed variable to increase by 0.2 every time the “slower” button sprite was clicked.
For this problem you were told to have a sprite have a conversation with you (the viewer) and after a series of questions, that sprite would talk to another sprite about the answers you gave. This problem required creating four different variables and using another variable provided by scratch called answer. I created a name variable and then I would command the sprite to ask a question like “What’s your name?”, and set the name variable to the answer. For different questions about food, grade, and activity I created new variables. Then I set the those variables about the questions to the variable of the viewers answer (use the answer variable, for example set the food variable to the answer variable). By doing this, when the sprite had to talk to the other sprite about the dialogue it was easy, as I used the broadcast message command and made the sprite say the answer from the specific variable.
For this problem you had to create a party with at least three sprites dancing and when the volume increased, at a certain point, the police should have arrived and the sprites should have ran away. To solve this problem my code involved a simple costume change for each of the dancing sprites. Then I created another sprite to increase the volume when it was clicked, so I used the volume variable. In the button code where the sprite changes the volume, I set the volume to 20. But then I added a command that changed the volume variable, so it would be whenever this sprite was clicked the volume would increase by 5. After doing this, I needed to get the police, so I used an if then conditional statement and an operator command. That statement was that if the volume variable was greater than 70 then to broadcast message 1. Message 1 would then sound a police siren and show the police and have the dancing sprites run away.