Scratch Lab 4

Quick Costume Change

Lab Overview

This lab required using a simple animation with a faster and slower button to pace of the sprites costume changes.

My Solution

I made a variable costume that I would use in a forever with the wait button. I then programmed the faster and slower buttons to alter the costume variable by .1 and -.1 costumes respectively. .1 costumes felt like an ideal interval for my program because the wait time for seconds is would be too slow with 1 whole second as an interval.


A.I.

Lab Overview

This lab required me making a sprite that asked for a name, grade, activity, and food. The sprite then in turn talked to another sprite about the person he just "met"

My Solution

I created 4 variables and set them all to the answers of the questions the sprite asked. Then in the conversation with the other sprite, my sprite recited the variables at the appropriate times.


Distance Formula

Lab Overview

This lab required the finding of a distance formula using 2 points on a euclidian plane.

My Solution

I programmed my sprite to ask for 4 variables, x1, x2, y1, y2. Then my sprite used the answers and made them variables. I then used the subtraction, multiplication, and sqrt operations to correctly plug in the distance formula. My sprite would then in turn say the final distance calculated.

Question 1

The variables in scratch are different then the variables in math class because we do not solve for them, their values can change, and we should know their values at all times.

Question 2

The variable can be applied to either all sprites or one sprite specifically.

Question 3.

A variable can only hold one value at a time.

Question 4

This doesn't work because value 2 cannot hold 2 values at the same time and it would just result in the same value for both.

Question 5

This is a successful code swap. The temp is changed to value 1, thus storing its data. Value 1 then becomes what value two is, and then value two becomes temp which is what value one used to be.