Tom Lilletveit
Tom Lilletveit

Reputation: 2002

Math: converting coordinate system to other system

I want to convert a map of 1200x1000 pixels to iPhone screen coordinates (480x360) so I can do some manipulation of where to user touches on screen. So let´s say I got 'player' on the map and he is at location 1200x1000 then I want that to correspond to the location on the iphone screen: 1200x1000 = 480x360. What math functions can I use to complete this?

Upvotes: 0

Views: 70

Answers (1)

sunapi386
sunapi386

Reputation: 1357

Instead of hard coding the map and touch locations, I think it would be better if you can convert to a relative frame. I.e. say he is at location 1200x1000 and your map is 5000x5000, then you could convert that to (1200/5000)% x (1000/5000)% and multiply by the screen size.

Upvotes: 2

Related Questions