Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'currently,': 0.09; 'lines.': 0.09; 'subject:Help': 0.11; 'def': 0.12; '(0,': 0.16; '0))': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iteration': 0.16; 'loop.': 0.16; 'loops': 0.16; 'pygame': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'drawing': 0.19; "shouldn't": 0.24; 'daniel': 0.26; 'header:In-Reply-To:1': 0.27; 'leave': 0.29; 'on,': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'correctly.': 0.31; 'running': 0.33; 'entirely': 0.33; 'subject:with': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'height': 0.36; 'should': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'up,': 0.60; "you're": 0.61; 'more': 0.64; 'jul': 0.74; 'walls': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=298lOizQC3TqaZVJhaEPO4O9wgAiS4/pM3NOHHYR6bs=; b=sMx8StgCskTiyLDwASz3AHYrFP/Alrf0mcgY/k8Aj7f3Nlr3ygC+E3tArxpvexu4Y8 srzBM3MEqbpQtMwb8zDfP3iOhxIsVcsO7+4xm9NfYJmT0hnhujvtzE5H6E3AoOCMDMv3 hNO+WtOpd5di/Si2p8Kx/pGrP7kahT6tegU0bfKAGau8hu4SGEFwDV0N/Ea1/DNZOuOI 01lzmJAX8HULKIYyy4Zh1Z1eVKlnPBc7dZuPtgLPujanpLb4itsAouXdxkgGHk875q2J AEDEUAI90+HZkRwArHSeYi65dDmyBiz7m6YyQR3mAVbiPmYK7g7MQJr4HQM85Uv63JMp kQ6A== MIME-Version: 1.0 X-Received: by 10.58.187.4 with SMTP id fo4mr830168vec.55.1373998605257; Tue, 16 Jul 2013 11:16:45 -0700 (PDT) In-Reply-To: References: Date: Wed, 17 Jul 2013 04:16:45 +1000 Subject: Re: Help with pygame From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373998614 news.xs4all.nl 15965 [2001:888:2000:d::a6]:43564 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50751 On Wed, Jul 17, 2013 at 3:29 AM, Daniel Kersgaard wrote: > def drawWalls(surface): > > #left and right walls > for y in range(HEIGHT): > surface.blit(wallblock, (0, y * BLOCK_SIZE)) > surface.blit(wallblock, (WIDTH * BLOCK_SIZE, y * BLOCK_SIZE)) > > for x in range(WIDTH): > surface.blit(wallblock, (x * BLOCK_SIZE, 0)) > surface.blit(wallblock, (x * BLOCK_SIZE, HEIGHT * BLOCK_SIZE)) Hm. I'm not entirely sure as I don't have pygame to test your code on, but this strikes me as odd: you're blitting the x loop once for every iteration of the y loop. Shouldn't the two loops be at the same indentation? I think you perhaps want to offset one of the lines. Currently, you're running x from 0 up, and y from 0 up, so you're drawing the (0,0) cell twice. If you add 1 to one of them, you should be able to draw all four walls correctly. Alternatively, leave this as it is, and just add one more draw at (WIDTH, HEIGHT) to fill in the last square. ChrisA