Try this.
import pygame
from pygame import Color, KEYDOWNspeedx=-4
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
def get_bbox(x,y):
ÂÂÂ left = x - radius + speedxÂÂÂ width = radius * 2 + abs(speedx) * 2
ÂÂÂ top = y - radiusÂÂÂ x+=speedx
ÂÂÂ height = radius * 2
ÂÂÂ return pygame.Rect((left, top), (width, height))
while True:
ÂÂÂ old_x=xÂÂÂ get_bbox(x,y)
ÂÂÂ screen.fill(pygame.Color("black"),get_bbox(old_x,y))
ÂÂÂ pygame.draw.circle(screen, color, (x, y), radius, 1)
ÂÂÂ 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 <abhasbhattacharya2@xxxxxxxxx> 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.