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

Re: [pygame] my rpg game (so far)



On Fri, 7 Nov 2008 15:39:49 -0500, Michael Fiano <michael.fiano@xxxxxxxxx>
wrote:
> Thanks, I got it. However, by having the map drawn to the screen before
> the player, the player is always on top of tiles even when it should be
> behind it. Therefor I still need some kind of foreground layer. I'm not
> sure what the best way to do this is? A subsurface, copy, new surface
> with same dimensions? also how am i going to link both layers together
> and have the player draw in between? Any help is appreciated.

That's a common problem. You're talking about situations like the hero
standing on grass (which should be drawn before him) and behind a tree
(which should be drawn after him), right?

One solution is to make a new layer of tiles that's drawn in a second pass.
Another is to mess with the game's perspective so that this never happens,
eg. you can never walk behind a wall. There are a couple of possible ways
to store a second-layer set of data; either use a second list of what tile
goes where (where most will say "nothing"), or a list specifying only the
spots where there is something (eg. "tree at 42,0"). With the second method
you could treat the in-front-of-player objects as being like sprites in
that they're large things drawn separately from the tiles.