Because of the limited Python 3 support, I've decided to attempt to push my over 600 lines of code back to Python 2.6. Surprisingly, it worked well for the most part, except for the following section of code.
crash = pygame.sprite.spritecollide(playerCar, computerSprites, False) if crash: for BlueCarSprite in crash: redracersprites26.BlueCarSprite.collide(BlueCarSprite, playerCar) for GreenCarSprite in crash: redracersprites26.GreenCarSprite.collide(GreenCarSprite, playerCar) for TruckSprite in crash: redracersprites26.TruckSprite.collide(TruckSprite, playerCar) This is a perfectly good piece of code in Python 3.1.3 which checks to see if a user controlled sprite collides with one or more computer controlled sprites, then passes the data off to the proper class method to handle the details. In Python 2.6.6, this section of code returns the following error TypeError: unbound method collide() must be called with BlueCarSprite instance as first argument (got GreenCarSprite instance instead) I have several questions as to what exactly is going on and what I should do, if you have any sort of answer to any of these questions, please respond. 1) What exactly is an "unbound method" error? I have been programming (in other languages) for several years on and off and have never heard of something like this. 2) What changes between 3.1.3 and 2.6.6 that makes this section of code not work? My best guess is that I'm missing something that lets the computer know that BlueCarSprite is an object type, but even if that's true, I wouldn't know what to do to fix it. 3) What would be a legit fix to my code to make it run? Sure, I guess I could write a Collide class and use that rather than my collide method, or perhaps a class that could act as a middle man between bits of code that I know work, but I know that there has to be a better way to fix this. Thank you to any and all who take the time to read this message, and especially to those who respond with any sort of feedback Greg
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor