### Introduction to Object Oriented Programming in Scratch

The Scratch Stage is a coordinate grid with an x-axis and a y-axis.

Every Sprite has a position on the stage. Sprites can be considered Objects on the stage. Every position is represented by a coordinate point with an x- and y coordinate.
As mentioned in the graphic on page one, the stage has limits with the x-coordinates b/t -240 to 240 and the y-coordinates b/t -180 to 180.
There are multiple blocks to travel around the stage.
Feel free to experiment with them!

All sprites have certain object data associated with them:

These can be used like any other regular variables. The idea of direction is new, but it refers to the orientation of the sprite (which way it is facing). All of these data points refer specifically to the current state of the sprite. In order to save states, you need to use a variable.

Rotation: Scratch provides commands to change the current “direction” of the sprite.

This block allows you to point/rotate the sprite to your mouse cursor.
Relative Motion: Many blocks will change the position or direction of the Sprite based on the current position and direction.

This will move ten steps (units) in whatever the current direction is.

This block will create relative linear motion on the edges of the stage (i.e. the bounce. Experiment with it.

There are three ways that the sprite can rotate:
All Around: can face any direction
Left-Right: only either faces 0 degrees or 180 degrees
Don’t Rotate: like it says, direction doesn’t change

Exercises:

Move the sprite to (90,90), then glide it to (-90,90) in one second, then move it to (-90,-90) and lastly glide it to (90,-90) in one second.
Draw a sphere in the costume section and use left arrow key & right array key to control rotational movement. Experiment with the different rotation styles here!
Given two points (both x and y coordinates), glide the sprite from one location to the other before calculating the slope (and printing this value). The formula for a slope is (Y2-Y1)/(X2-X1)
Create an arrow-key game that allows you to move the sprite around the screen. Include a A-D control system that allows you to rotate both left and right with the sprite.
New England is on the boundary between deciduous forest (like oak trees) and coniferous forest (pine trees). Create an imaginary boundary down the y-axis. If your WASD controlled sprite is to the right of this boundary, it will print out “coniferous territory.” Otherwise, it will print out “deciduous” territory. This will simulate the real world. (Hint: You will need to use the x-position data block to determine whether the sprite is to the left or right of the y-axis)