Closed jeremy886 closed 2 years ago
No, for the simple reason that this isn't how Pygame works. Pygame Zero sticks close to Pygame in the way it presents the world.
For example, you can access pixels in a surface, and the indexing is from the top left. That's the way that surface buffers work in memory and it is also the order in which pixels are stored in most image file formats (BMP being the most common exception).
Most window systems produce input events that are y-down (e.g. Windows). SDL and Pygame events are y-down.
In essence, it's just the native thing for software 2D graphics.
Hardware graphics have ample opportunities to convert the coordinate transform. OpenGL defaults to y-up, but you can override this, just adjust the projection matrix. But then you need to convert input events, like mouse positions, to be relative to the bottom left if you want them to match draw coordinates.
Even in hardware graphics and professional game engines, there's no consistency. Unity's 2D coordinate system is y-up. Unreal's is y-down. (And in 3D you also have handedness: https://twitter.com/DJ_Link/status/952185276218200065).
So, it is arbitrary, but Pygame Zero's system is well-justified.
One thing that I do regret in Pygame Zero is that angle of rotation is anticlockwise with increasing angle
. This is wrong, angle should be given by atan2(y, x)
, which means that rotation should be clockwise. I don't see an easy way to fix this decision at this point.
Hi, I used Python Turtle with students this year and Mu editor in a code club. Both were well received. I'm keen to introduce game design as one of Maths projects and I'm comparing pgzero and arcade libraries. Both are good for me but there seems to be more resources fro pgzero (books, courses from FutureLearn). So far, I have a concern over pgzero; that is its coordinate system. I used to think it is perfectly normal to have the y coordinate starting from the top but I am working at a more disadvantaged school now and I would like to help them see the use of the Cartesian plane rather than introducing a different one. I know I can write a function to convert the existing coordinate pairs to the normal ones. I wonder if a configurable setting can be considered in the future.