我在python中使用了一个类(我在这个程序中也使用了pygame),但是它不允许我调用这个特定的方法。这个班叫做”敌人”。
这是问题解决方法:def attack(self, screen):
self.charx = self.screen.get_width()/2 – self.pic.get_width()/2
self.chary = self.screen.get_height()/2 – self.pic.get_height()/2
textbox(self.screen, self.charx – self.c.rect.x + self.rect.x, self.chary – self.c.rect.y + self.rect.y, 15, 5, True, (255, 255, 255), True, (0, 0, 0), 0, ”, True, (255, 0, 0), 15*self.healthpercent)
if self.rect.colliderect(self.w.rect):
if self.agilityrandom.randint(1, 10) > self.c.agilityrandom.randint(1, 10):
self.c.health -= self.level*5
if self.agility*random.randint(1, 10)
Original: https://blog.csdn.net/weixin_39968309/article/details/112944924
Author: weixin_39968309
Title: python中int对象不可调用_在python中使用类时获取“TypeError:”int“对象不可调用”…
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/783384/
转载文章受原作者版权保护。转载请注明原作者出处!