[Tutor] Mapping of co-ordinates... pygame
Muhammad Ali
ali.jan at gmail.com
Thu Jul 23 14:09:38 CEST 2009
Hi,
I have some x and y co-ordinates ranging from (-100, 100) for each x and y.
Something like this:
100
|
|
|
|
-100------------------------------100
|
|
|
|
-100
I would like to plot them on a pygame surface.
I have found that pygame surface is (0, 0) at top right to (width, height)
at the bottom right corner, like this:
(0,0) (width, 0)
------------------------------------
| |
| |
| |
| |
| |
| |
| |
------------------------------------
(0,height) (width, height)
I need a way to map any value from my range to this surface so I could do
stuff like this:
pygame.draw.circle(screen, color, (x, y), size
Also my range could vary from -5, 5 or -500 to 500 so I need something
generic...
It looks like a simple problem but I can't seem to be able to figure it out.
Thanks,
Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090723/4f0add79/attachment.htm>
More information about the Tutor
mailing list