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

Re: [pygame] Pygame Problem Solving 1



Lamonte Harris wrote:
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.

That sounds more complicated than necessary. There's no
need for an "invisible rect" -- just get the mouse
coordinates and test them against the map rects using
the collidepoint() method.

--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing@xxxxxxxxxxxxxxxx	   +--------------------------------------+