Problem Solving 1
--------
Rendering a map switching script.  There will be a simple window.  At the
bottom if tge screen it will say pick a map.  Using the mouse events and
positioning I will be able to click on the squares that will represent
certain maps at the bottom of the screen and the different maps will be
displayed.

How to do that?
---
First make my "genmap" class then in the __init__ function add 2 variables "
self.cmap" and "self.blockrect".  "self.cmap" would represent the current
map to be displayed.  If there isn't a variable assigned then the area above
the boxes will not be displayed.  Make a function to display the tile maps.
With that function I would append square rects to te "self.blockrect"
variable for later use to detect if the current mouse position will match
any of the rects when I left mouse click on the pygame window.  In that
list, there could be tuples inside the list for instance:

self.blockrect = [((0,0,0,0),1)]

The first value in the tuple would be the map rect second value in the tuple
would represent the map name in the directory to load.

How would I get the current top surface of where my mouse is located?
Just giving a guess, I was thinking of making a square surface thats the
same size of the sqaures at the bottom of the screen but the sqaures at the
bottom of the screen have different possitioning meaning its easier to
located different maps. Like example:

Pygame Window:
----------------------------------------
|                          ___       |
|          |--\_/--|  /-\ |___|      |
|          |_/\/\_| /---\|            |
|                                      |
|                                      |
|                                      |
 --------------------------------------
|   ------     ------    ------         |
|   |    |     |     |   |      |         |
|   ------     ------    ------         |
 --------------------------------------

 Thats above is the whole window its all one big part but sort of seperated
if you get what I mean.  Probably by a pygame line.

 So I was thinking if I made an invisible rect that moved when the mouse
moved then I left clicked and it would get the current surface position of
the rect, then it would run a function to see if that current position
matches any of the map squares at the bottom of the screen then the "
self.cmap" variable would update.


Does anyone think my theory will work, I've only written then down at school
and is attempting to do this this weekend for some more learning with
pygame.

Thanks for the read Lamonte.

Reply via email to