oops. I should add that to my list of dumb bugs i find in the code i write. Like this one:
if key[K_RIGHT]: spaceship.speed = spaceship.speed+10 if key[K_RIGHT]: spaceship.speed = spaceship.speed-10 :) --- On Sat, 4/25/09, Tyler Laing <[email protected]> wrote: From: Tyler Laing <[email protected]> Subject: Re: [pygame] Never seen this before To: [email protected] Date: Saturday, April 25, 2009, 9:12 AM Okay, I had assumed you had written your own python class, subclassing one of the Group classes, and had used .add within the overridden method. I've made that mistake myself. Looking at your code, I see the issue. For one, Group.add takes in a list of sprites. You are passing in three separate arguments, and Group.add is thinking they are each sprites. You should change enemies.add(random.choice(("enemyblue.png", "enemycyan.png", "enemygrey.png", "enemyyellow.png")), item, enemybullets) to enemies.add(Enemy(random.choice(("enemyblue.png", "enemycyan.png", "enemygrey.png", "enemyyellow.png")), item, enemybullets)) The super method can take a class and an object as parameters, and it will call the method on the superclass of the class given. It is the same as Basicsprite.__init__(self, img) For reference, here is the documentation about Group.add: http://www.pygame.org/docs/ref/sprite.html#Group.add -Tyler On Sat, Apr 25, 2009 at 6:34 AM, Yanom Mobis <[email protected]> wrote: the two files for the game are attached --- On Fri, 4/24/09, Brian Song <[email protected]> wrote: From: Brian Song <[email protected]> Subject: Re: [pygame] Never seen this before To: [email protected] Date: Friday, April 24, 2009, 9:57 PM If the problems fixed, yay. If not, you should put up most/all your source so it's easier for people to see whats happening. -- Visit my blog at http://oddco.ca/zeroth/zblog
