[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Isometric Math



Can anyone offer advice on isometric math?

Say that I've got an iso landscape like this:
kschnee.xepher.net/pics/iso060601.png
(I've since switched to 128x64 tiles; these are 90x45.)

I know where to put the tiles based on a height map and some arbitrary starting point, but:
-How can I make sure the screen is always filled, without black areas as in many iso games?
-How do I do "picking," identifying the tile or character a user has clicked on? I can imagine calculating it for a flat iso landscape, but taking height into account all I've come up with so far is to save a bunch of bounding rectangles and test them inefficiently.
-How do I use this engine smoothly given that I'm loading a "zone" around the player and the 8 around that zone, like an endless treadmill? In my previous 2D code I had a sort of "playmat" surface that I drew to once, then scrolled through. Now if I draw that and then the sprites, they'd appear in front of things that should obscure them. So should I draw each tile individually, caching those drawings between frames for speed? This seems like it'd also let me do things like have a translucent water layer.
-How can I make sure the camera follows the player's sprite? I worked it out in 2D but am not sure it'll work in iso, especially since the player will go up and down.
-How can I make characters move properly up/down slopes? I'd think they'd get their feet inside the edge of a slope when rising, if I just found the delta-(x,y) and moved a bit along each axis per frame. Giving characters a velocity creates interesting possibilities for physics, but also sounds hard.
-I can't do smooth rotation with iso, but I could rotate the height/texture maps to switch instantly between 4 angles, right?


Kris