Oops. I spotted a couple things I changed to aid my experimentation, and
did not revert. They do not affect the operation of the program, but I want
to identify them as a red herring so you don't waste time wondering about
the differences.

The import Color and KEYDOWN. This had no impact on the behavior.

The calls to get_bbox() are reversed in pygame.display.update(). This had
no impact on the behavior either way.

The changes I made that do impact the code are the lines that contain
speedx.

Cheers,

Gumm


On Fri, Jun 13, 2014 at 9:42 AM, B W <stabbingfin...@gmail.com> wrote:

> Try this.
>
> import pygame
> from pygame import Color, KEYDOWN
>
> w,h=800,200
> fps=60
> pygame.init()
> screen = pygame.display.set_mode([w, h])
> color=pygame.Color("white")
> clock=pygame.time.Clock()
> radius=20
> x,y=800,100
> speedx=-4
> def get_bbox(x,y):
>     left = x - radius + speedx
>
>     top = y - radius
>     width = radius * 2 + abs(speedx) * 2
>
>     height = radius * 2
>     return pygame.Rect((left, top), (width, height))
>
> while True:
>     old_x=x
>     x+=speedx
>
>     screen.fill(pygame.Color("black"),get_bbox(old_x,y))
>     pygame.draw.circle(screen, color, (x, y), radius, 1)
>     get_bbox(x,y)
>     pygame.display.update([get_bbox(old_x,y),get_bbox(x,y)])
>     clock.tick(fps)
>
>
>
> On Thu, Jun 12, 2014 at 7:32 PM, Abhas Bhattacharya <
> abhasbhattachar...@gmail.com> wrote:
>
>> What is also quite surprising is that the circle gets cut off in the
>> same direction in which it is moving. That makes me think it cant be a
>> v-sync/screen-refresh issue.
>>
>
>

Reply via email to