Lab Write Up

Name: Sam Basilico

Period: 7

Assignment: Lab #4

Lab Overview

In this lab, the task was to create a simple animation for a sprite and have it switch to that costume and back forever. But what you had to have here was a button that controlled the rate at which the sprite switched costumes.

My Solution

My solution to make a vairable that decreased the wait time between the costume changes a little bit each time the button sprite was clicked. I also had another button sprite that added a little bit amount of time between costume changes to make it move slower each time it was clicked. I could not have done this lab without the use of variables.

My Project Link

Lab Overview

In this problem, I had to create a psrite that asked the user qeustions and stored them. When the sprite was done asking you questions, another sprite appeared and they talk about the user together using the information they had just learned.

My Solution

My solution to this problem was to make a ton of variables that represented each question and stored the answer. Then, the sprite broadcasted a message that made another pswrite appear and I gave them a lot of talking commands where i inserted the varuiables into the speech so they could be talking about the user.

My project link

Lab Overview

In this lab, there should be 3 sprite that are dancing and a button that controls the volume of the music they are dancing to. When the music gets above a certain volume, the police came and made the sprites run off the screen.

My Solution

My solution was to set a variable that increased each time a button sprite was clicked. Then a set an equality so that when the noise level was at a certain point, I broadcasted a message that made the police appear. Then when the police appeard, all of the sprites had a glide command that made them leave the screen..

My Project Link

Questions

  1. Are variable in computer programming the same as variable in math class?
    • They are because you can set the variable to anything you want like x = number of chairs
  2. When creating variables, what are the two types of scope a vairable can have?
  3. the two types of scopes a variable can have is the one assicated with the computer like volume and the other is user inputed stuff
  4. How many values can a variable store at one time?
    • A variable can only store one value at a time
  5. What does the following code snippet do?
    • the code snippet will set value 1 to value 2 and value 2 to value 1. This does not work as intended because it will create a loop.
  6. Explain what happens in this snippet
    • It sets a temp variable to value 1 but also sets value 1 to value 2. Then, it sets value 2 to temp. This also causes a loop.