Help on Collision Detection Please
My collision detection won't work, why?bt1 = pygame.Rect(0, 0, 5, 5)
bt2 = pygame.Rect(0, 0, 5, 5)
bt3 = pygame.Rect(0, 0, 5, 5)
you_box = pygame.Rect(0, 0, 25, 44)
btm1 = Rect.move(bt1, bx, by)
btm2 = Rect.move(bt2, bx2, by2)
btm3 = Rect.move(bt3, bx3, by3)
you_boxm = pygame.Rect.move(you_box, x,y)
collide = Rect.collidelistall(you_box, bt1)
It won't work, why?!
(log in to comment)
Comments
I hope you are trying to find the collision of other objects with you_box.
here is how it should be
bt1 = pygame.Rect(0, 0, 5, 5) bt2 = pygame.Rect(0, 0, 5, 5) bt3 = pygame.Rect(0, 0, 5, 5) you_box = pygame.Rect(0, 0, 25, 44) list = (bt1, bt2, bt3) you_box.collidelistall(list)This will work
Thanks, it works now!
One prob though, I want to break the loop whenever they collide, how can I do that?
Ok, just worked it out, but it's crashing my code, the only way I can stop it, is if I know how  many digits are in the string, or if it's empty, so how can I find out how many digits are in a string, (if there is any).
Do you mean the length of a string? len(s) returns that. It returns 0 if the string has no characters (the length is 0).
 john
      john gizmo_thunder
    gizmo_thunder john
    john Tee
    Tee
 eugman  on
2007/04/03 10:38:
    eugman  on
2007/04/03 10:38:
You probably need to use move_ip . If you don't move in place then you are just saving to btm1 what you would get if you moved. Just a random guess.