TypeError: attack() missing 1 required positional argument: 'self'

前端 未结 2 1930
陌清茗
陌清茗 2020-12-07 04:52

hi im getting this error

TypeError: attack() missing 1 required positional argument: \'self\'

and this is my code

class En         


        
2条回答
  •  醉酒成梦
    2020-12-07 05:01

    You need to create and use an instance of the class, not the class itself:

    enemy = Enemmy()
    

    That instance is then accessible as self. If you don't have an instance, then it's missing and that's what the error message tells you.

提交回复
热议问题