Mapping coordinates to screen in PyGame

wg4568

Ok, lots of explaining to follow, so bear with me.

I'm making a 2D top-down game in PyGame, and I have a "chunk loading" system set up. The system is as follows...

I have a "world" object, made up of "chunks". Each chunk is 16x16 "tiles" and contains data for each one of those tiles. In the world object, I have a system for generating these chunks as needs be, and storing them in a dictionary, like {(x, y):"grass"} etc... Each tile in the chunk is a 10px image, that needs to be drawn to the screen in PyGame, given the position of the camera (counted in tiles). I want the camera to be able to pan around over the top of these images, and move around. How on earth can I make this work?

A quick diagram...

diagram http://williamgardner.noip.me/files/chunks

I hope this makes sense, thanks!

derfium

If I understand your problem right, TomTsagk explained it really good:

Pygame camera follow in a 2d tile game

Hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Transformation the screen coordinates to stage coordinates

From Dev

glViewport incorrectly mapping normal coordinates to window coordinates?

From Dev

QML Screen Coordinates of Component

From Dev

Screen coordinates in R

From Dev

Display touch coordinates on screen

From Dev

Triangle texture mapping with barycentric coordinates

From Dev

Mapping coordinates to item not working as expected

From Dev

Finding coordinates of the circumference of circle in pygame

From Dev

How to get coordinates of image in pygame

From Dev

How to convert workspace coordinates to screen coordinates?

From Dev

How to convert screen coordinates to control coordinates

From Dev

screen coordinates to sharpdx device context coordinates

From Dev

How to convert workspace coordinates to screen coordinates?

From Dev

How to get object coordinates from screen coordinates?

From Dev

Pygame screen width

From Dev

Display PyGame Mask on screen

From Dev

pygame blinking screen fix

From Dev

pygame skipped updating screen

From Dev

Pygame screen flickering

From Dev

Black Screen using PyGame

From Dev

Are the coordinates in WINDOWPOS on WM_WINDOWPOSCHANGED in parent coordinates or screen coordinates?

From Dev

How to calculate transformation from screen coordinates to isometric screen coordinates?

From Dev

Points coordinates in multiple screen CoronaSDK

From Dev

gl_PointSize to screen coordinates

From Dev

GetWindowRect coordinates not screen-relative

From Dev

Get the center coordinates of phone screen

From Dev

Get Screen-Coordinates of a QuickControl

From Dev

Get the center coordinates of phone screen

From Dev

Get coordinates (screen) of GridLayout items

Related Related

HotTag

Archive