[Tutor] Fwd: circular movement in pygame

diliup gabadamudalige diliupg at gmail.com
Wed Apr 29 11:15:00 CEST 2015


x=42 good
x += 42 -x ?

That does not go by a mile of what I asked.
Alan, are you telling me that there is no way that one can arrive at X2
which is the NEXT place that X1 will be after "some increment"?
old x position = X1

new x position= X1 + some increment value
which can be written as :new X = oldX + some increment value

which can be simplified to X += some increment value?

my orginal question was

*Why does the object NOT move in a circle when implemented as a class?*

All the code was provided.


The above is  what I asked. (I hope this is clear enough)









On Wed, Apr 29, 2015 at 1:56 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> On 29/04/15 09:03, diliup gabadamudalige wrote:
>
>> Thank you Alan. Understood. I already knew that. My question is
>>
>> How to to do it the second way.
>> some code = what?
>>
>>  The point is you cannot do it.
> The second approach always uses the current value of x.
> The first approach may or may not use the current value
> of x. If it does not use x then the += style cannot be
> made to work (unless you tag a -x on at the end!
>
> x = 42
>
> x += 42-x
>
> Which is just stupid.
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>


-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************


More information about the Tutor mailing list