⭐ 2.2 Geometry and pixels
A computer screen or a picture is made up of tiny dots known as pixels. X and Y coordinates are respectively the horizontal (X) and vertical (Y) addresses of any pixel or addressable point on a computer display screen.
In Scratch, one unit of X or Y, or one step is equal to one pixel. The X coordinate is a given number of pixels along the horizontal axis of a display starting from the pixel (pixel 0) in the centre of the screen. The Y coordinate is a given number of pixels along the vertical axis of a display starting from the pixel (pixel 0) in the middle screen. Together, the X and Y coordinates locate any specific pixel location on the screen.
To familiarize yourself with XY gridlines, follow these steps:
Step 1: Click on the button “Choose a Backdrop” as shown on the figure below.
Figure 57: Choosing a backdrop
Step 2: In the search box of “Choose a Backdrop” window type “xy-” without quotes to filter all the backdrops starting with “xy-”. Three backdrops will be listed. Choose the one named “Xy-grid” by clicking on it.
Figure 58: Choosing a new backdrop
You will get the stage of XY-grid with a sprite in the centre.
Figure 59: XY-grid backdrop
Step 3: To observe well the XY-grid stage you can hide the sprite as shown below.
Figure 60: Hiding the sprite
Step 4: You can go back to the collection of backdrops and choose the xy-grid-30px (Figure 61).
Figure 61: Choosing a new XY-grid-30px
The result is an XY-grid that consists of small squares of 30px by 30px.
Figure 62: XY-grid with interval of 30 pixels