<div dir="ltr"><div><div><div><div><div><div>Hello everyone. <br><br></div>I am having a good time programming with Python 3.3 and Pygame. Pygame seems like the perfect platform for the kind of simple games that I want to make.<br>
<br></div>What I have currently programmed is basically a drawn rectangle filled with 200 squares, each side of the squares being 43 pixels. The rectangle is 20 squares by 10 squares.<br><br>This grid is what I want to have the entire game on. There will be pieces that move certain numbers of squares, perform actions that effect pieces on certain squares, etc. The possibilities are endless.<br>
<br></div>So what I am now trying to do is organize these squares into objects that I can easily reference when programming things related to the squares. <br><br></div>So far, I have done this: <br><br></div>A1 = pygame.Rect(10, 12, 43, 43)<br>
</div>A2<br><div><div>A3<br>A4<br>B1<br>B2<br>etc.<br><br>where said integers are the precise location of the top left-most square for A1, and onward down the line. I would guess that I could continue on in such a fashion, with appropriate box names for each square. But I'm running into the problem of confirming that the code above actually does something useful. For example, I would love to be able to turn A1 a different color, but how does this work? How do I actually utilize these object variable names? Are there methods that I am not aware of, because most things I try tend to do nothing or crash the game. For example, A1.fill(BLUE) does not work. <br>
<br></div><div>Any general advice about how to organize my squares into something that is easy to program for would be VERY appreciated. Basically all the games I want to make involve square grids like this, so I want to know as much about them as possible.<br>
<br></div><div>Thank you very much for reading this,<br>Andrew<br></div></div></div>