[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] y-Sorted RenderGroup




    steve> Hello,

    steve>    I've developed a RenderUpdate group that sorts it's sprites on
    steve> their y position, useful for things like Japaneese style RPGs where
    steve> sprites closer to the bottom of the screen are drawn first, and
    steve> sprites near the top of the screen are drawn last.

Looking at the code, I see you sort based on rect.top instead of a logical y 
position. In other words, it won't work if you want sprites in your game to 
have various heights. I suppose the solution to this is to make all sprites
contain a logical position independant of their location on the screen (ie,
world location), and them map it onto the screen by that. (if you want to get
fancy, you can have a 'hotspot' in each sprite that should line up with its
logical location on-screen, but otherwise you can just use the bottom of the
image [ie, where its feet/base meet the ground])


-- 
                                Chris Armstrong
                         << radix@twistedmatrix.com >>
                http://twistedmatrix.com/users/carmstro.twistd/

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org