Python Forum

Full Version: Could you help with this bug I have looked for like 20 minutes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import Items

class Player:
    def __init__(self):
        self.inventory = [items.RedBloodCell()]
        self.hp = 100
        self.location_x, self.location_y = world.starting_position
        self.vicory = false

    def is_alive(self):
        return self.hp > 0

    def move(self, dx, dy):
        self.location_x += dx
        self.location_y += dy
        print(world.tile_exists(self.location_x, self.location_y).intro_text())

    def move_north(self):
        self.move(dx=0, dy=1)

    def move_south(self):
        self.move(dx=0, dy=1)

    def move_east(self):
        self.move(dx=1, dy=0)

    def move_west(self):
        self.move(dx=1, dy=0)

    def attack(self, enemy):
        best_weapon = None
max_dmg = 0
if isinstance: Items.Vaccine()

if i.damage > max_dmg:
    best_weapon = i

print("You use Vaccine against Flu!".format(best_weapon.name))
enemy.hp -= best_weapon.damage
if not enemy.is_alive():
    print ("You killed Flu!".format (enemy.name))
else:
    print ("Hp is 0.".format(enemy.name, enemy.hp))
TypeError: object.__init__() takes exactly one argument (the instance to initialize) on line 33 and 15
You need to post the whole traceback on the error. From what you have said, in line 33 of this file the error could be in the init of the Items class, but we don't see that module.