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

Re: [pygame] layers and/or tiles?




On Feb 1, 2008, at 11:37 AM, Gregg Jensen wrote:

Please excuse the beginner type questions and I will gladly accept
redirection/pointers/link to documentation that will assist.

I would like to create an interface for a game that will run on a
limited size display 800x480 (ie Nokia tablet N800).  In order to be
able to have access to a lot of different information, I would like to
be able to put some information on a tile/layer/window that would slide
out from the side of the display.  Then when done viewing it, tap it
(ie, the tablet doesn't use a mouse) and it slide back to the left.
Actually, I would like to have several of these sliding windows come
from the left of the display and one or two from the right.  These
windows would come out about 1/4 of the display when "pulled out". The
game is a card game, so the main display would show one players hand.
Then with a tap from the top of the screen, there would be another
sliding window that would come over the main players display and show
the other players hand. There would be a graphic "knob" to tap to pull
out that appropriate window.

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 you can do it, but pygame won't help much beyond the low-level drawing and event mechanism.

I have a game with sliding panels that contain controls. They have tabs that show when then panel is hidden. Clicking on the tab slides the panel up, clicking again slides it off. The tabs also have hotkeys to activate them.

You can find the code in the panel.py module here:

http://eos-game.svn.sourceforge.net/viewvc/eos-game/

This depends on several other modules in the game, in particular, event.py and widget.py.

The Panel base class in panel.py contains the code that handles the sliding animation.

-Casey