mouseThreePressed = True if drawQuadtree: drawQuadtree = False else: drawQuadtree = True elif event.type == pygame.MOUSEBUTTONUP and event.button == 3 and mouseThreePressed: mouseThreePressed = False quadTree.reset() for particle in particles: particle.randomMove() quadTree.insert(particle) if drawQuadtree: quadTree.draw(screen) for tree in quadTree.loop(): for particleA in tree.particles: particleA.colliding = False for particleB in tree.particles: if particleA != particleB and Particle.checkCollision( particleA, particleB): particleA.colliding = True particleA.draw(screen) pygame.display.update()