I have question. My ball is allways moving in 1 of 8 directions but when i click LEFT or RIGHT arrow I want to change direction and turn in smooth arc. I need advice what should I write to conditions for keys. I'm beginner but this is my code:
import pygame
pygame.init()
import random
win = pygame.display.set_mode((1280,720))
x = random.randint(150,1130)
y = random.randint(150,570)
vel = 1
x_direction = random.randint(-vel, vel)
y_direction = random.randint(-vel, vel)
while True:
x += x_direction
y += y_direction
pygame.time.delay(10)
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
pass
if keys[pygame.K_RIGHT]:
pass
win.fill((0,0,0))
pygame.draw.circle(win, (255,0,0), (x, y), 6)
pygame.display.update()
pygame.quit()