[Tutor] Mapping of co-ordinates... pygame

Muhammad Ali ali.jan at gmail.com
Fri Jul 24 07:08:50 CEST 2009


Thanks Wayne and Alan,

Here is what I finally ended up with:

def newCoord(x, y, oldWidth, oldHeight, newWidth, newHeight):
    return( newWidth/2 + newWidth/oldWidth * x), (newHeight/2 -
newHeight/oldHeight * y)

for my earlier example, the old width and height would be 200, 200
respectively.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090724/a3f419f7/attachment.htm>


More information about the Tutor mailing list