Hello! (I am new here so don't flame me please!)
This is a problem I my self just solved.
There a few things you have to do first:
1:) first make the image a "rect" by doing the following:
a:) make your image
b:) make a new variable and set it as IMAGE_rect = image.get_rect()
that will make your image a rect! [almost all physics in pygame have to do with rect]
Type in the following:
if IMAGE1.colliderect(IMAGE2) == True:
speed[0] = -speed[0]
if IMAGE2.colliderect(IMAGE2) == True:
speed2[0] = -speed[0]
so basically if IMAGE1 collides with the image in the () [if it's "True"] do something. In this case, move backwards.
There you go! (If I really suck at teaching look at this page:
http://www.pygame.org/docs/tut/intro/intro.html and this one:
http://www.pygame.org/docs/ref/rect.html)
Hope this helps!
-Proga