Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44837

Re: Collision of Two Rect

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 <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.079
X-Spam-Evidence '*H*': 0.85; '*S*': 0.01; 'variables': 0.07; 'integers': 0.09; 'pixels': 0.09; 'screen.': 0.09; 'variables.': 0.09; 'cc:addr:python-list': 0.11; 'posted': 0.15; '*never*': 0.16; 'pygame': 0.16; 'subject:Two': 0.16; 'wrote:': 0.18; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'rid': 0.24; 'sorry,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'received:209.85.217': 0.29; 'thus': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'about.': 0.31; 'agree': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'representing': 0.36; 'should': 0.36; 'two': 0.37; 'received:209': 0.37; '8bit%:4': 0.38; 'sure': 0.39; 'ian': 0.60; 'worry': 0.60; 'times': 0.62; "you'll": 0.62; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'default': 0.69; 'agreement.': 0.91; 'careful': 0.91; 'notion': 0.91; 'suspicious': 0.91; '\xa0there': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=qMnJ92WnFoZ54K03IHJdy36B0KopAksEaWWaLIlnRw0=; b=uIyVaeTFYv/QdaWuQUaHz/HeJeJyYEfKVFg5FJR0hFGrgCCa+izVjaSprbH7sO3AIk ydRnIY3u6t663rw0TQ4j5X2AoVswDr9IPA3RSfe77922Wn9fUr3MXukm/pEqmyxJP6bc Jsk9VsS5XT4/4VkQkxDgNRb2eedgedNahnBuQsSK/iID3qEPVvxQc5p2br4wWAF5+Nqt BubbmePKcLEdLxM1cmACB15znikuhI8ApUgJu8y7LItLCQhC2Jqkmz6VBS18UgANocC2 jBaLCd0Uzx8eaNqDTSpq0ZXBT+vsLBWRPHEnuF028eFqlgmfOZCljhvdt4qwPxZzOpqt lxqQ==
X-Received by 10.112.89.104 with SMTP id bn8mr7798834lbb.92.1367858374703; Mon, 06 May 2013 09:39:34 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CALwzidnwKpy-gN9LE3JkgwKOFD8M3hvySDL_x9ter6Hi2ptOQQ@mail.gmail.com>
References <9083ecbc-5666-41aa-aacb-3f08f062feed@googlegroups.com> <CALwzidnwKpy-gN9LE3JkgwKOFD8M3hvySDL_x9ter6Hi2ptOQQ@mail.gmail.com>
From Joshua Landau <joshua.landau.ws@gmail.com>
Date Mon, 6 May 2013 17:38:54 +0100
Subject Re: Collision of Two Rect
To Ian Kelly <ian.g.kelly@gmail.com>
Content-Type multipart/alternative; boundary=001a11c36b4287032504dc0f5810
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1367.1367858382.3114.python-list@python.org> (permalink)
Lines 56
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367858382 news.xs4all.nl 15899 [2001:888:2000:d::a6]:46451
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44837

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 4 May 2013 00:42, Ian Kelly <ian.g.kelly@gmail.com> wrote:

> The other thing that is suspicious about the code you posted is that
> it has two different notions of the ball's position that are not
> necessarily in agreement.  There is the ball_rect, and there are also
> the x and y variables.

<snip>

> You should be careful to make sure these
> variables agree at all times -- or better yet, get rid of x and y
> entirely, so that you only have one notion of the ball's position to
> worry about.


Pygame uses integers for its Rects and thus I advise much the opposite:
*never* store position in Rects.

Sorry, but it's true. You'll need to keep x and y around and try to use
Rects only when representing pixels on the screen. Pygame has a lot of
deficiencies with its default set of objects and functions, so it's
something to get used to.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Collision of Two Rect Alex Gardner <agardner210@gmail.com> - 2013-05-03 15:23 -0700
  Re: Collision of Two Rect Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-03 17:42 -0600
  Re: Collision of Two Rect MRAB <python@mrabarnett.plus.com> - 2013-05-04 01:51 +0100
  Re: Collision of Two Rect Tim Roberts <timr@probo.com> - 2013-05-04 22:28 -0700
  Re: Collision of Two Rect Joshua Landau <joshua.landau.ws@gmail.com> - 2013-05-06 17:38 +0100
  Re: Collision of Two Rect Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-06 14:18 -0600

csiph-web