I have a simple game and I want my mouse click (button doesnt matter) to only register once per click. Right now it works even if it is held down.
def drawer(x, y):
pygame.draw.circle(screen, (0, 0, 0), [int(x), int(y)],20)
def main():
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
exit()
if event.type == pygame.MOUSEBUTTONDOWN:
playerY_change = -player.vy
if event.type == pygame.MOUSEBUTTONUP:
playerY_change = player.vy
player.y += PlayerY_change
drawer(player.x, player.y)
# Other game code
pygame.display.update()
Right now the players movement keeps changing as long as you hold down the button where I want it to change only per click. How do I go about this?