Sign in to follow this  

Implementing a Coordinate World System with Scrolling in Python

This topic is 4351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am making a small 2D game with Python that has an overhead view of the world much like the earlier Pokemon games. I was wondering if anybody had any ideas about how to implement something like that in Python with a free scrolling camera that tracks the player when he moves around the world or in this case a parking lot? I'm using the PyGame package for graphics and such. Thanks in advance.

Share this post


Link to post
Share on other sites
It's pretty much the same as in any language: each thing in the world has a position, but when you draw it you offset it relative to the position of the player you're tracking, plus half the size of the screen to centre on the player.

eg. player is at 400,100. tree is at 500, 250. Screen is 800x600.
So, you draw the tree at (500 - 400) + (800/2) in the x axis and (250 - 100) + (600/2) in the y axis.

You may get more hints from the Isometric forum as that is more suited to 2D game implementation questions. The PyGame part of it is fairly straightforward if you look at the documentation and examples.

Share this post


Link to post
Share on other sites

This topic is 4351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this