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

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



On Fri, 7 Nov 2008 21:06:30 +0000
Kris Schnee <kschnee@xxxxxxxxxx> wrote:

> 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.
> 

Ok, I'm attempting for the first solution. I tried blitting a copy of
the background surface containing all foreground tiles to the screen
after the player was blitted, but that resulted in a non-alpha surface
(all i see is the foreground tiles...everything else is black). Then I
tried the same thing with a subsurface of the background with the same
rect area. The result was a perfect foreground and background, but no
player...so still, no alpha to the surface or something. I tried
set_alpha() but I'm guessing that sets the per-pixel alpha as this just
made it completely invisible. How can I blit 2 surfaces of the same
size to a screen and see through the holes to the bottom surface?