One thing I noticed about your code is you're making your own rectangle.
The draw function returns a rect so you should pass that. It's useful
because the rect it returns is constrained by the screen so there's less to
update. Plus you don't have to make as many rects. But that doesn't fix
your pro
I just tried this on a Mac, and it works fine,
no flickering or tearing.
The only thing I can think of is that, on your system,
display.update() is not waiting for vertical sync,
whereas display.flip() is.
The pygame docs aren't very clear about whether it's
supposed to or not. They say that fli
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 be
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