Jump to content
  • Advertisement
Sign in to follow this  
PhlashStudios

Implementing a Coordinate World System with Scrolling in Python

This topic is 4515 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!