[Tutor] TypeError

Kent Johnson kent37 at tds.net
Mon Feb 4 02:26:34 CET 2008


Seon Kang wrote:
> class EnemyPokemon(games.Sprite):
> 
>     image = games.load_image("bulbasaur.bmp")
> 
>     def __init__(self, speed = 2, odds_change = 200, y = 240):
>         """ Initialize the Chef object. """
>         super(EnemyPokemon, self).__init__(image = EnemyPokemon.image, y 
> = 240,
>                                    x = 580,
>                                    dy = speed)
>        
>         self.odds_change = odds_change
>         self.time_til_shoot = 0

> enemy_pokemon = EnemyPokemon(games.Sprite)

Here is the problem. The EnemyPokemon.__init__() method takes a speed 
parameter, an int. You are passing it games.Sprite, a type. The speed 
parameter becomes dy for the sprite and causes the error.

Kent



More information about the Tutor mailing list