4,107 Points

The exact place of a platform

When we choose coordinates for a platform, how to understand that which part of the platform will be located on that coordinate? As far as I remember from high school mathematics, you can choose or give exact coordinates to only points. We cannot give only one X, and one Y coordinate to a triangle or a rectangle (the closest shape of our platforms).

Zimri Leijen
Zimri Leijen
11,673 Points

Without knowing any context of the question, I think the coordinates of any shape are just referring to the corner of the shape (probably the top-left pixel, or bottom right).

1 Answer

The positioning for platforms specifies the location of the top left corner of the platform. You can get the dimensions of the platform by clicking the image in the file list on the left hand side. For example platform_1.png is 192 x 32 pixels. Then to test just do the math (800-192 = 608 and 600-32 = 568).

platforms.create(0,  0, 'platform');
platforms.create(608, 568, 'platform');

The first platform is at the top left of the screen. The second platform is at the bottom right.