import pygame
import sys
SCREEN_SIZE = WIDTH, HEIGHT = (800, 800)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
CIRCLE_RADIUS = 30
pygame.init()
screen = pygame.display.set_mode(SCREEN_SIZE)
pygame.display.set_caption('Circle')
fps = pygame.time.Clock()
paused = False
ball_pos = [400, 400]
def update():
ball_pos[1] += 1
frames_counted = 0
frames_over_ball = 0
def render():
if not pygame.mouse.get_pressed()[0]:
global frames_counted
frames_counted += 1
global frames_over_ball
color = (229, 0, 0)
screen.fill(BLACK)
circle = pygame.draw.circle(screen, color, ball_pos, CIRCLE_RADIUS, 0)
if circle.collidepoint(pygame.mouse.get_pos()) and pygame.mouse.get_pressed()[0]:
frames_over_ball += 1
color = (123, 241, 168)
pygame.draw.circle(screen, color, ball_pos, CIRCLE_RADIUS, 0)
pygame.display.update()
fps.tick(140)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYUP:
if event.key == pygame.K_SPACE:
paused = not paused
accuracy = int((frames_over_ball/frames_counted) * 100)
print(accuracy, "%")
if not paused:
render()
if pygame.mouse.get_pressed()[0]:
update()
This is my current program, it creates a circle, when I hold click on the circle it moves the circle down thanks to the update() function, my goal is to have the circle move in a similar pattern to the spray in valorant (image attached), any ideas on how I can accurately make the circle move in that pattern and with the right timing? Here's a video on what the pattern looks like - https://youtu.be/4r7ZZ4NdYzE?t=17