Basically I'm very new to Python and game making, but I've coded a lot before. I'm making a simple game just to have a play around basically where a ball runs into some other balls and they delete as it hits them.
At the moment it works okay, but sometimes it doesn't register the collision on some of the balls. Here's my code for the collision and the redraw
pygame.draw.rect(screen,(0,0,0), (50,50,edge_x,edge_y))
screen.blit(ball,(x,y))
for food in foods:
if food.x < x+35 and food.x > x and food.y < y +35 and food.y > y or food.x < x-35 and food.x > x and food.y < y -35 and food.y > y:
foods.remove(food)
Score = Score + 1
break
for food in foods:
screen.blit(foodImage, food)
screen.blit(label, (100, 10))
I thought the reason it might not be detecting it, is because of my collision isn't in sync with where the for loop is in the list of sprites, but I could be wrong.
Any ideas?