Lab Write Up 4
Name: Cameron Beattie
Assignment: Lab #4
This problem focused on using variables to increase or decrease the size of a sprite.
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.
This problem focused on using variables to collect information and use it in a conversation
I had a sprite ask pretty bland personal questions and store the answer as a variable, then he used those variables in a conversation with his over enthusiastic friend Felicia. I also added some secrets using "if, then" statements (try saying "babies" for favorite food, or try being past grade 12)
This problem focused on using variables and "if, then" statements to trigger a specific event
I used the volume variable to change the volume and once it reached a certain level, had a script run to make all the other sprites run away.
- Are variables in computer programming the same as variables in math class? Why or why not?
- yes they pretty much are, you can assign any value to a variable and insert it in an equation, regardless of what the variable is called
- When creating a variable, what are the two types of scope a variable can have? That is, what can it affect.
- Numbers to be used in an equation and information/words to be displayed later on
- How many values can a variable store at one time?
- It can only store one value at a time
- What will the following code snippet do? Explain why it doesn’t work as intended.
- it changes the value of 1 to 2, though I think it was supposed to switch their values. it doesn't work because when value 2 switches to 1, 1 is already set as the same value as 2.
- Given the following code snippet, explain what is happening.
- It basically gives the 3 variables a rotation of values, each variable will adopt a different value each time the sprite is clicked until it's origional value comes back around.