points-collision

I was trying to do a list of points which were the x and y coordinates of where a sprite collides. its fine but the issue is that i think since its iterating, its giving me more than one point on collision. how can i make it so if it hits a point then the score will go up but only once? code is below, its under the update function of the sprite that is colliding:

 for point in points:
            if self.rect.collidepoint(point):
                score += 1
                print(f"Collision with point: {point}")

Posted Mar 8, 2025, 12:49 PM UTC

110
Loading comments…