Python Forum
Could you help with this bug I have looked for like 20 minutes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could you help with this bug I have looked for like 20 minutes
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  calculating the datetime objects to get the minutes chris0147 1 3,914 Apr-04-2018, 12:04 AM
Last Post: snippsat
Sad Twitch Chat Bot - Disconnects after 10 minutes sp4wny 0 4,923 Dec-20-2017, 08:28 AM
Last Post: sp4wny
  just a trial. Please wait 5 minutes before deleting this thread sylas 2 4,832 Jun-06-2017, 03:34 PM
Last Post: snippsat
  Subtract Minutes from Datetime.Time tkj80 2 46,724 May-11-2017, 09:56 AM
Last Post: klllmmm

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.