[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Fw: rect.center.. confusion over result.. or bad result?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Fw: rect.center.. confusion over result.. or bad result?
- From: "Brad Montgomery" <brad@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 Dec 2008 18:57:06 -0600
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Thu, 04 Dec 2008 19:57:10 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=lMjZoTAf5MQEuoNLM3q4fquoDG7DlkyUr+T9Tggmnv8=; b=KI2xYels5rkR/hdE8LSolq3atqnCqeEKoRXUnXaKCFPw/DXRycxTJwo5I4OBikVgbO tsGqXap+g3Oq4jUJpxWMlX9tboAzpgdrI8IWW840kv7xmuzQnDRC4/EJQyLkYw86GRRS mJybH8D9ZVikg8uzRmBSmVpT8j2SmVQXlU+fM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=YxLlDEu2I55Hrm1iUI4C+a5Rck+X7BP9fn29Q8/wE7W4Ry2ntKVFKY6VDLD68H1Q9r 4mGcdAeURBLtYdEj/pKvVKy4TKtwKEUkRsH9CxdlEqnihxAvQOoGXiaMjkRf9W28DC80 sv/1sfd12oh9wqQCqn1iuCxo88C7zX0wiX6NY=
- In-reply-to: <555C7E204C7D4AF5BF021838E9F2EC1F@ChestnutTree>
- References: <555C7E204C7D4AF5BF021838E9F2EC1F@ChestnutTree>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
On Thu, Dec 4, 2008 at 6:44 PM, Lin Parkh <lparkh@xxxxxxxxxxx> wrote:
> #I define a rectangle:
> tes =pygame.Rect(0,44,200,85)
Double-check the Constructor for a Rect:
http://www.pygame.org/docs/ref/rect.html
pygame.Rect(left, top, width, height): return Rect
>
> #now i would expect the center of this rectangle to be be
> ((200+0)/2),(44+85)/2)) in other words (100, 64) instead I get:
>
> tes.center
>
> (100, 86)
>
> Where did the 86 come from????
> Please advise. Thanks for any help!
Also look at the following attributes (top, left, right, bottom,
topleft... etc).
your rectangle's height is 85, and the top is at 44.
Half the height of the rect is 85 / 2 = 42, but that point must be
shifted 44 units in the horizontal:
42 + 44 = 86
--
brad [bradmontgomery.net]