Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'squares': 0.07; 'subject:Question': 0.07; 'grid': 0.09; 'integers': 0.09; 'python': 0.11; 'names?': 0.16; 'pygame': 0.16; 'pygame.': 0.16; 'appropriate': 0.16; 'variable': 0.18; 'trying': 0.19; 'basically': 0.19; 'pieces': 0.19; 'seems': 0.21; 'programming': 0.22; 'color,': 0.24; 'precise': 0.24; 'tend': 0.24; 'this:': 0.26; 'certain': 0.27; 'appreciated.': 0.29; 'related': 0.29; 'andrew': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'crash': 0.31; 'running': 0.33; 'guess': 0.33; 'could': 0.34; 'problem': 0.35; 'advice': 0.35; 'possible.': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'everyone.': 0.36; 'done': 0.36; 'example,': 0.37; 'turn': 0.37; 'easily': 0.37; 'being': 0.38; 'thank': 0.38; 'actions': 0.38; 'filled': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'easy': 0.60; 'most': 0.60; 'utilize': 0.61; 'numbers': 0.61; 'entire': 0.61; 'simple': 0.61; 'kind': 0.63; 'such': 0.63; 'different': 0.65; 'love': 0.65; 'side': 0.67; 'useful.': 0.68; 'square': 0.74; 'confirming': 0.84; 'endless.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=f686t9S1qSgvrhEuCmH55lEPU3Xg35AyjKgepfxdR1U=; b=JBwJiGD1RGPA9hsqtltUHxvOgC6Lu5+fXlKGgSkprT+t7nSnqebH8VpD3BoLY/8mJs uL0NKiTHdpG1gVnUeZn8tx3vFEcC1oKxN/pI2ZPcyCBN42mfEraDU2ztU37Dt7Iaft2D sPbN8Ud8Y8SpF0N/TTVrreZ940/oWhj2M9Shr5ZQd3O3aZg2scMYaiPOeOc4oSsCFbOQ xtOH10QfkTWkKKWzD8B/Q4tlCl9b/jzOlBRM2JSdhffxaTrH3Km3p3qRpOTa0u90hmwx SDixTHeLyxsqCMIU5Rvv3R2cU5LvApZt09+YorhH6ZSF9+VXh7slYxhuccuwNlU322ap SnMg== MIME-Version: 1.0 X-Received: by 10.50.51.167 with SMTP id l7mr6154278igo.11.1368637020054; Wed, 15 May 2013 09:57:00 -0700 (PDT) Date: Wed, 15 May 2013 12:56:59 -0400 Subject: Question re: objects and square grids From: Andrew Bradley To: python-list@python.org Content-Type: multipart/alternative; boundary=14dae9340b5f68296204dcc4a352 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 83 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368637030 news.xs4all.nl 15954 [2001:888:2000:d::a6]:40911 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45356 --14dae9340b5f68296204dcc4a352 Content-Type: text/plain; charset=ISO-8859-1 Hello everyone. 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. 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. 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. 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. So far, I have done this: A1 = pygame.Rect(10, 12, 43, 43) A2 A3 A4 B1 B2 etc. 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. 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. Thank you very much for reading this, Andrew --14dae9340b5f68296204dcc4a352 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello everyone.

I am having a good time programming with Python 3.3 and Pygame. Pygame se= ems like the perfect platform for the kind of simple games that I want to m= ake.

What I have currently programmed is basically a drawn rectangle f= illed with 200 squares, each side of the squares being 43 pixels. The recta= ngle is 20 squares by 10 squares.

This grid is what I want to have t= he entire game on. There will be pieces that move certain numbers of square= s, perform actions that effect pieces on certain squares, etc. The possibil= ities are endless.

So what I am now trying to do is organize these squares into obje= cts that I can easily reference when programming things related to the squa= res.

So far, I have done this:

A1 =3D pygame.Re= ct(10, 12, 43, 43)
A2
A3
A4
B1
B2
etc.

where said intege= rs 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, wi= th appropriate box names for each square. But I'm running into the prob= lem of confirming that the code above actually does something useful. For e= xample, 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 nothi= ng or crash the game. For example, A1.fill(BLUE) does not work.

Any general advice about how to organize my squares into som= ething 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.

Thank you very much for reading this,
Andrew
--14dae9340b5f68296204dcc4a352--