Presentation is loading. Please wait.

Presentation is loading. Please wait.

The coordinate system Susan Ibach | Technical Evangelist

Similar presentations


Presentation on theme: "The coordinate system Susan Ibach | Technical Evangelist"— Presentation transcript:

1 The coordinate system Susan Ibach | Technical Evangelist
Sage Franch | Microsoft Student Partner

2 Why are coordinates important? (What are they used for?)
The position of objects are used to… Determine when an object goes off the screen Determine when objects overlap And much more…

3 The coordinate system you are used to
y increasing y axis x increasing (0, 0) x decreasing y decreasing x axis Two number lines that intersect at the point where each is 0. (0, 0) is called the origin.

4 Points are plotted as pairs: (x, y)
y axis (5, 4) 4 (0, 0) 5 x axis -4 (5, -4)

5 The coordinate system on a computer is similar, but different…
y axis y INCREASING (0, 0) x axis

6 A screen is made up of pixels
x axis (0, 0) 21 20 (21, 20) Positive! y axis

7 In our game… Width = 800 pixels x axis (0, 0) 400
The robot’s starting position is (400, 200) – the center of the game board. Only his y-coordinate changes as you play. (Motion of obstacles and background makes it appear as if the robot is moving forward.) 200 Height = 400 pixels Characters (or sprites, as they are called) are actually rectangular pictures. The position of the sprite is the “center” of the rectangle. y axis

8 Setting positions, sizes, and speeds

9 Your challenge Add an obstacle Set its height Set its x-position
Set its y-position to be a random number Set its speed

10 Congratulations! You are a master of the coordinate system!

11 Vocabulary and concepts
Pixel: A tiny dot on a computer screen A screen is made up of a rectangular grid of pixels The coordinate system: Used to track the location of objects in a game. All sprites are rectangular A sprite’s location is the point at the center of its rectangle The origin (the point (0,0)) is in the upper left corner of the screen Values on the y-axis INCREASE as you move DOWN

12


Download ppt "The coordinate system Susan Ibach | Technical Evangelist"

Similar presentations


Ads by Google