# Pygame collision detection less frequent when objects are increased

I currently experiencing an issue in pygame where whenever i increase the number of objects e.g. platforms, rocks

for a in range(150):
rock = Rock(0,0)


OR incresing the range which they spawn in:

rock.rect.x = random.randrange(-200,30000)
rock.rect.y = random.randrange(80,500)


LINE 232

(which i really need to do for an ENDLESS mode) collision detection between the player and all the objects that have have been changed will become less frequent, so the character will just go through th objects as they weren't even there... you can see the character fall through the objects, it falls through in front of the object and not behind. All game code is below, I have tried a number of different techniques and values but I have found that these numbers and ranges work best.

Collision Detection code: FOR PLATFORM

medium_collide = pygame.sprite.spritecollide(player, medium_list, False)
if medium_collide:
player.rect.y-=2


FOR ROCK

    rock_collide = pygame.sprite.spritecollide(player, rock_list, True)
if rock_collide:
lives-=1
if rock_collide:
player.rect.y = 100
player.rect.x = 50


!!!!!GAME CODE BELOW!!!!!

GAME CODE

• No, I mean something like if player.x < object.x or player.y < object.y or player.x+player.width > object.x or player.y+player.height > object.y: do stuff – Kroltan Jan 27 '14 at 23:30