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

Re: [pygame] layers and/or tiles?



On Fri, 01 Feb 2008 13:37:22 -0600, Gregg Jensen <g_jensen@xxxxxxxxxx>
wrote:
> Obviously, I am not experienced with pygame, but the question, is there
> something like this concept already built into pygame. Would this be
> accomplished by a tile? Or, is there some other concept of a rectangular
> area that can be defined that can have various graphical images and
> fonts drawn on it, that can be animated to appear to slide out from the
> side and over top the bottom screen (hence my thought of layers).

Short answer: yes, it's doable. (I'll hopefully write more later.) Try
drawing something to a surface "s" and then blitting "s" to the screen each
frame, and keeping track of a set of coordinates for it. Just change the
coordinates and you have a moving window. Or track "in" and "out" sets of
coordinates, and if the current coords aren't where the current destination
(in or out) is, change the current coords by some speed (dx,dy). That would
give you an animated moving window sliding in and out. The contents of "s"
don't change (unless you want them to), just where they're drawn. If you
get weird results, make sure you're blanking the screen each frame before
drawing.