Programming and Mathematics
Why?
In order to create programs, you will require some Mathematic skills.
As this year we have lessoned the amount of time doing Mathematics we will be increasing the numeracy of this course
As this year we have lessoned the amount of time doing Mathematics we will be increasing the numeracy of this course
X & Y & Z Activity
You should have done the first 2 scratch activities by now.
Our First set of activities will be examining the two axis x & y. We will look at how they are important and what they can be used for in video games. Task 1: Log into Minecraft and answer some questions 1.) Open Onenote  Minecraft CoOrdinates Activity 2.) Open Minecraft 3.) Log in with your school account 4.) Click Play > View Library > Subject Kit > History and Culture > City of Florence complete the activity and take screenshots where one note is asking you to. Task 2: Answer the following question? For Minecraft: What is X? What is Y? What is Z? What happens if you go below zero? Task 3: Nga Motu. Download this minecraft world: https://aka.ms/NGAMOTUWORLD Open it up and complete the activities 
Hint:
1.) Screenshots can be taken by hitting Windows + Shift + S 2.) You may have to go into the settings to turn the coordinates on 
Video Games & X,Y,Z
3D video games use X & Y & Z axies in order to determine the location of things.
These are coordinate numbers, and the computer uses them to determine where each character should be. X & Y is used differently in this game

2D Games use just X & Y, because they have no depth
Look at this picture of Mario for example it uses x and y to jump around the screen 
X & Y Axis in Scratch
Scratch and X & Y
Scratch is a 2D game editor, meaning it only uses X & Y Axis
(Although some people have manipulated the engine to seem like it includes Z) Task 1: Get Started 1.) Log onto scratch 2.) Create a new scratch game, and delete the cat 3.) Add an egg and make it size 50 4.) Open Scratch Task 2: Move the Egg to different locations 1.) Add the code on the right to the egg to make it appear in the centre for .5 seconds 2.) Add more code to make it appear in the top left, top right, bottom left and bottom right 3.) Take a screenshot and add it to the OneNote "X & Y, Scratch activities page" Take note that in order to make it bottom left it needs use entirely negative numbers. Task 3: Random Placement We can make the egg appear in a random location, within the 4 different quadrants. Add to the code on the right to make it appear in a random location within the four quadrants Add a screenshot to one note Task 4: Gravity We can now simulate gravity Add a ball to the code Make the ball appear randomly at the top of the y axis Use the change y by 10 to make the ball drop to the ground if y goes past 170 it should go back to the top again I have given you the code on the right in order for you to put together. Task 5: Line Graph In Mathematics you will learn about plotting graphs Graphs use X & Y axis just like game programming For this task we are going to create a graph using a sprite. Getting Started: 1.) Draw two lines as a background in scratch 2.) Using the + tool add the pen code 3.) Create a new sprite and set it to start at the bottom left Using the "Glide 1 secs to" code draw a graph using X & Y Coordinates Hopefully we now have somewhat of an understanding of how x & y work in Mathematics and programming 
Angles and Rotation
Video Games use rotation and angles to figure out all sorts of things
Angles are also used by many builders, architects, plumbers, surgeons etc So for this section we are going to examine angles and how they work with games like scratch. Task 1  Spin Me Around 1.) Create a new scratch project and put the mouse in the middle of the screen, make it size 50 2.) Create a variable called "angle" 3.) Use the code on the right to spin it around 4.) Adjust the code so that the mouse angle will be reported at the top left 5.) Take a screenshot of the code and put it into the one note page and answer the questions. Task 2  Right Angles and drawing a square Squares use right angles 1.) Delete the code for the mouse 2.) Keep the mouse 3.) Install the Pen tool In order to draw a square we need to use what is known as a right angle or 90 degrees. 4.) Modify the code on the right to get the mouse to draw a square. Take a screenshot and put it into one note Task 3  Other Shapes
Try to create the following shapes by modifying the code Put the pictures onto the one note page Beginner: 2 additional shapes (rectangle and rhombus) Advanced: 4 additional shapes Expert: all additional shapes Task 4  Physics and Angles Programming games makes good use of angles Set up the mouse like this to get it to bounce around the screen: Notice the problem, the mouse only moves around in a specific set of angles forming a nice oblong... Experiment by changing the turning angle if touching the edge The issue is that it is still uniform So how do we change it so that it isn't so exact? We can use a randomiser... use a randomizer to change the angle to be between 8595 take a screen shot of the Pattern produced 
Basic Number < > +  / x
Scratch can be used to do high level math equations
However we are going to use it to make some basic text games Task 1: Greater then or less then 1.) Delete the cat 2.) Create a goblin that says the following: "Hi There" "I won't let you leave the woods unless you guess my magic number" 3.) Copy the code on the right, so that if the number is less then he will laugh at you. 4.) Develop your own code to get the goblin to tell you if it is higher or it is right. If it is right he should let you out of the woods Task 2: Adding Variables Rather then using the same number in all the code, use a variable instead Task 3: Random number Set a random number to be the magic number and then include Also include a loop so that it keeps asking until you get the answer right You will need this code: 
The Calculator
We are going to create a calculator for our final task:
Task 1: Create scratch program on the right Extra for experts: Make the button change colours when you click on it and change back again Task 2: Make the buttons do something In order to make this work, we need the make the buttons control the man in the middle to do this we use a command called "Broadcast" Use the example on the right to program the calculator so that when you click on a button it talks to you. Program all the buttons to do this Task 3: Addition 1.) Create two variables called number 1 and number 2 2.) ask the user for both these numbers 3.) add them together to present the answer Task 4: All other features Get the other buttons to also work 