MyLeoNes™

Coordinates: placing things on a screen — Computing, 11–13 years

Coordinates give every position on a screen an address made from numbers. They let programs place, move and find objects precisely.

A number address for a place

A screen can be treated like a flat map. One number says how far across a point is, and another says how far down it is. Together, such as (120, 80), they identify one position where a picture or character can appear.

Why use coordinates?

A program cannot point with a finger or say “a little left” reliably. It needs a precise way to describe places, especially when screens have thousands of positions. Coordinates solve this by turning location into numbers that can be changed.

Moving a character

A character starts at (40, 100). Step 1: adding 20 to the first number moves it right, to (60, 100). Step 2: subtracting 30 from the second moves it up, to (60, 70), if smaller vertical numbers mean higher on this screen. The pair records each move.

The corner is not always (0, 0)

A common mistake is assuming every coordinate system starts and grows in the same way. That seems reasonable because school graphs usually put (0, 0) at the lower left. Many screens put it at the upper left, so moving down increases the second number.

Games, maps and drawings

Games use coordinates to place characters, enemies and objects. Drawing apps use them for lines and shapes, while digital maps use positions for places. In each case, coordinates are useful because the program must know exactly where something is.

Keep exploring

Other languages

Loading MyLeoNes™…