So here is a simplified version of my code in which I am trying to plot these images using a for loop. But when these images are on the screen they sometimes overlap or touch each other. So what can I do to stop that.
import pygame
import random
win_size = (600, 400)
win = pygame.display.set_mode(win_size, 0, 32)
jumperImg = []
jumperx = []
jumpery = []
for i in range(5):
jumperImg.append(pygame.image.load("anyimg.png"))
jumperx.append(random.randint(0,600))
jumpery.append(50)
def jumper(x, y, i):
win.blit(jumperImg[i], (x, y))
running = True
while running:
for event in pygame.event.get(): # event loop
if event.type == pygame.QUIT:
running = False
for i in range(5):
jumper(jumperx[i], jumpery[i], i)
pygame.display.update()