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

RE: [pygame] Isometric Math



Funnily enough, in the example code I linked in my reply, that's pretty much
exactly what I did.

Although instead of "shadowing" the underlying tile, I just had a duplicate
image of the tile but with a yellow border, so once the coordinates were
worked out, I'd just blit the yellow-bordered tile onto the rect, and (I
think, I haven't touched the code in a while) destroyed it when the cursor
left the currently "selected" rect.

If you progress with this isometric stuff, and get around any of the
following issues, I'd love to hear how you got around them:

1) I had a mechanism that allowed you to "pick up" the entire iso grid and
move it around on screen. Whilst this worked fine without any actors on the
grid, when I did eventually populate the area with them, picking the grid
and moving it around caused the actors to *almost* stick to their original
locations, but eventually they would "forget" the constraints of the grid
and start rolling off it, etc.

2) Sort of associated with above. I wanted to have an effect that moving the
grid in any direction would cause the background image to move
proportionally slower in the same direction of the grid movement (to give
more pseudo-parallax effect). I got it working, but encountered problems
with the fact that the grid would never escape the bounds of the camera, but
the background image *would* escape the bounds and would start gradually
edging out of the camera, leaving nasty trails. I was using an image that
was approximately double the size and width of the grid (and had its center
underneath the center of the grid) to give me plenty of "play", but I just
couldn't keep the background from escaping.

3) If you *do* have actors strolling across the grid in their correct
isometric directions, I found a problem with the fact that an actor placed
before (or was it after?) another actor, but further "North" would mean if
the two actors crossed paths at some point, the actor placed further north
would blit *through* the actor to the south, whereas it should really blit
*behind*.

Like I said in my original reply, my code will probably give you a good idea
how not to do things, but I left a few ideas in there that would certainly
spark your imagination, and possibly have enough information about how I
solved *some* problems to keep you going :)

Good luck!

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]On
Behalf Of Kris Schnee
Sent: Wednesday, June 14, 2006 18:16
To: pygame-users@xxxxxxxx
Subject: [pygame] Isometric Math


I see the responses, and will get to them tonight -- short on time.

I had an idea, though, on "picking": how about creating a hidden 
graphics layer where the top of each iso-tile is "shadowed" with a 
unique color representing its coords? (eg. tile (4,2) gets color 
(0,4,2).) Then when the user clicks on the landscape, you can just 
get_pixel to find the tile # that was clicked on!

Kris




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.