Нужно справить шарик который ДРОЖИТ по оси X, в независимости от радиуса. Чем больше я увеличиваю fps тем быстрее шарик падает
import random as rnd
WIDTH, HEIGHT = 1200, 800
fps = 60
# ship
ship_w = 125
ship_h = 35
ship_speed = 15
ship = pygame.Rect(WIDTH // 2 - ship_w // 2, HEIGHT - ship_h - 10, ship_w, ship_h)
# ball
ball_radius = 10
ball_speed = 6
ball_rect = int(ball_radius * 2 ** 0.5)
print(rnd.randint(ball_rect, WIDTH - ball_rect))
dx, dy = 1, -1
ball = pygame.Rect(rnd.randint(ball_rect, WIDTH - ball_rect), HEIGHT // 2, ball_rect, ball_rect)
pygame.init()
sc = pygame.display.set_mode((WIDTH, HEIGHT))
clock = pygame.time.Clock()
# image
img = pygame.image.load('SPACE228.jpg').convert()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
sc.blit(img,(0, 0))
# то что нарисованно (корабль)
pygame.draw.rect(sc, pygame.Color('purple'), ship)
pygame.draw.circle(sc, pygame.Color('green'), ball.center, ball_radius)
# передвижение ball'a
ball.x += ball_speed * dx
ball.y += ball_speed * dy
if ball.centerx < ball_radius or ball.centerx < WIDTH - ball_radius:
dx = -dx
if ball.centery < ball_radius:
dy = -dy
if ball.colliderect(ship) and dy > 0:
dy = -dy
# управление
key = pygame.key.get_pressed()
if key[pygame.K_LEFT] and ship.left > 0:
ship.left -= ship_speed
if key[pygame.K_RIGHT] and ship.right < WIDTH:
ship.right += ship_speed
# screen update
pygame.display.flip()
clock.tick(fps)```