Python inheritance problem -


I am making a game, and I have some problems ... I have a function that loads the map (Usually when the player collides with a gate). I have two doors and two maps (one gate on each map) when I will run on one door, the second map is full, when I walk through the gate of that map, the first map loads. I already have a tree on the map. Everything is fine till I click on that tree. This is very strange because I do not have anything that handles it! Nothing should be done! And in fact, nothing happens, except that when I try to withdraw from other maps it does not work!

This error message I receive:

  traceback (most recent call final): file "guilds.py", line 820, & lt; Module & gt; Load_map (objekt.gate_path, objekt.name, False) file "guilds.py", line 287, load_map in NPC (o [1], o [3]) file "guilds.py", in line 147, __init__ creature. __int __ (self, position, name) type error: __init __ () takes 3 arguments (4 given)   

Therefore there is a problem loading the NPC from the map (NPC The class gets from

a) NPC:

  class npc (animal): def __init __ (self, private class):  

( Name, name): self.move_target = crt.crt [name] ['move_target'] if 'search' crt.crt [name]: self.quest_name = crt.crt [name] ['quest_name'] self.move_quest = Crt.crt [name] ['move_quest'] self.q_giver = true second: self.q_giver = wrong self.guild = crt.crt [name] ['guild'] lista_npc.append (self) Animals: .__ init __ (self prize, name)

b) Animals, which are obtained from NPC:

  class creature (): def __init __ (self, status, name): self.pic = [] self.lista_slika = crt.crt [name] ['ls_slk'] for slika in self.lista_slika: self.pic .append (pygame.image.load ( Slika) .convert ()) Load image for self.pic in slika: self.colorkey = slika.get_at ((0,0)) # first pixel to Koloki 0,0) slika.set_colorkey (self.colorkey, RLEACCEL) self.counter = int (time.time ()) self.time = int (time.time ()) self.pos = pos self.rect = self.pic [0] .get_rect () #get Image rectangle .rect = self.rect.move (self.pos) # Returns the rectangle on the initial position Do self.current_health = crt.crt [name] ['health'] self Max_health = crt.crt [name] ['health'] self.name = name self.targeted = False self.targeted_3 = wrong lista_creature.append (self ) Follow def (self): if self.face == 0: self Rect = self.rect.move (NPCspeed_right) self.pos = (self.pos [0] + NPCspeed_right [0], self.pos [1] + NPCspeed_right [1]) if self.face == 1: self.rect = Self.rect.move (NPCspeed_left) self.pos = (self.pos [0] + NPCspeed_left [0], self.pos [1] + NPCspeed_left [1]) If self.face == 2: self.rect = Self.rect.move (NPCspeed_up) self.pos = (self.pos [0] + NPCspeed_up [0], self. Pos [1] + NPCspeed_up [1]) if self.face == 3: self.rect = self .accure (self -100, 100) self.randin2 = random.randint (-100, 100) self.pos = (self.pos [0] + self-rendin, self.pause [1] + self -Rendin 2) self.combat = Wrong self curent_health = self.max_health self.rect.move_ip (self.Randin, self.randin2) for self.targeted = L Search in ista_quest: if quest.target_name == self.name and quest.onit == true: quest.goal - = 1    

You have a global variable" creature "that is hiding your class.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -