for what ever it's worth I'd like to share the code below with you.
I got the code to do what I wanted. Object falls onto a rotating platform
and stays there without falling off.
video is here - https://www.youtube.com/watch?v=I6c5cKhLuo4
import sys, os, pygame
from pygame.locals import *
from
Thanks all for the very informative responses especially to Alan for being
descriptive.
I am now going to make my movement linear and move away from my current
circular one.
I hope a little bit of fun and Thank you emails fall into the order of
the day..
:)
On Thu, Apr 30, 2015 at 9:13 AM,
Thanks all for the responses.
Charles Cossé - yes I can write a simple pygame program that makes a
sprite move in a circle but it may not be the style and order that many may
approve or accept. I consider myself a student. :)
No one has pointed out why the object moves in a circle properly in the
On 29/04/15 08:15, diliup gabadamudalige wrote:
1. x = some code
That is what I used and it worked. I was trying to find how we can do the
same thing by updating the current position by doing
2. x += some code
Above 1 works. 2 does not. Why is that?
Because they do completely different
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
On 29/04/15 10:15, diliup gabadamudalige wrote:
x=42 good
x += 42 -x ?
That does not go by a mile of what I asked.
You've asked three different things:
1) Why the += form gives different results from the assignment form,
2) Why some code you apparently wriotre worked outside a class
but
I do not understand how Alan does not get the code that is in this thread.
Anyway I can conclude by saying that a friend of mine who is not in this
thread solved the problem and I would like to share it with you. He has
changed only a very smal portion in the original code that i posted in this
On Wed, Apr 29, 2015 at 11:37 AM, diliup gabadamudalige
dili...@gmail.com wrote:
I do not understand how Alan does not get the code that is in this thread.
Hi Dilliup,
Please try to avoid using the phrase, I don't understand how X does
not get Y
You might not realize it, but it's
Thanks Alan.
It is partly due to curiosity but I also wanted to have a common update
method. And as I almost always use the x+= some code, y+=some code for
animation stuff I wanted to know how it could be done using this method
rather than finding each position separately and assigning with x=
On 29/04/15 21:19, diliup gabadamudalige wrote:
It is partly due to curiosity but I also wanted to have a common update
method. And as I almost always use the x+= some code, y+=some code for
animation stuff I wanted to know how it could be done using this method
rather than finding each
question to Lucas.
Not sure if this is what you're looking for, but I would also use cos for
the x coordinate as suggested. If:
self.rect.x = self.radius * math.cos(self.angle) + self.center_x
self.rect.y = self.radius * math.sin(self.angle) + self.center_y
Take a derivative (assume: angle +=
Thank you Alan. Understood. I already knew that. My question is
How to to do it the second way.
some code = what?
My question is, how does one arrive at the code to put in place of some
code? The code I used does not work correctly.
The code is in this chain of email.
I hope I am clear in what I
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 =
On 04/29/2015 02:37 PM, diliup gabadamudalige wrote:
I do not understand how Alan does not get the code that is in this thread.
There are at least 3 ways of posting to this thread:
A) email
B) newsgroup
C) googlegroups
and at least 5 ways of looking at this thread
A) email
B)
On 04/28/2015 02:37 PM, diliup gabadamudalige wrote:
I thank all those who responded to my question
Here is the code that I had written.
When updating is applied to a surface object the rotation works but when it
is applied through a class to an object it goes wrong in about 3 rotations.
As
I thank all those who responded to my question
Here is the code that I had written.
When updating is applied to a surface object the rotation works but when it
is applied through a class to an object it goes wrong in about 3 rotations.
As far as I can see the code is the same. What is wrong? If
-- Forwarded message --
From: diliup gabadamudalige dili...@gmail.com
Date: Tue, Apr 28, 2015 at 6:22 PM
Subject: circular movement in pygame
To: pygame-us...@seul.org
Looking at the code on this page lines 47 48
On 28/04/15 16:38, diliup gabadamudalige wrote:
-- Forwarded message --
From: diliup gabadamudalige dili...@gmail.com
Date: Tue, Apr 28, 2015 at 6:22 PM
Subject: circular movement in pygame
To: pygame-us...@seul.org
It's good that you tried the python-game list for a
pygame
On 28 April 2015 at 16:38, diliup gabadamudalige dili...@gmail.com wrote:
Looking at the code on this page lines 47 48
http://programarcadegames.com/python_examples/show_file.php?file=sprite_circle_movement.py
is there a way to do
self.rect.x +*= some value*
self.rect.y += some value
On 28 April 2015 at 19:37, diliup gabadamudalige dili...@gmail.com wrote:
I thank all those who responded to my question
Here is the code that I had written.
When updating is applied to a surface object the rotation works but when it
is applied through a class to an object it goes wrong in
20 matches
Mail list logo