AttributeError: 'tuple' object has no attribute 'move' - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: AttributeError: 'tuple' object has no attribute 'move' (/thread-16387.html) |
AttributeError: 'tuple' object has no attribute 'move' - senfik99 - Feb-26-2019 I am really dying to solve this issue. Once I add enemy_0.move() or enemy_0.draw I just get black screen and this error: https://pastebin.com/HjuWZUTV Since I'm still new and following this Zenva course I just want to finish it as I find it good and move somewhere else.Thank you for your help!! RE: AttributeError: 'tuple' object has no attribute 'move' - moveax3 - Feb-26-2019 You have a typo in your code. You need replace this: enemy_0 = NonPlayerCharacter = ("enemy.png", 20, 600, 50, 50)to this: enemy_0 = NonPlayerCharacter("enemy.png", 20, 600, 50, 50)This is line 52 of your code from Pastebin. You need to make an instance of NonPlayerCharacter class, but you have the symbol of equality, and you have tuple instead NonPlayerCharacter. RE: AttributeError: 'tuple' object has no attribute 'move' - stullis - Feb-26-2019 The problem stems from line 52: enemy_0 = NonPlayerCharacter = ("enemy.png", 20, 600, 50, 50)This line instantiates enemy_0 as equal to NonPlayerCharacter and both are equal to the tuple ("enemy.png", 20, 600, 50, 50). To correctly instantiate enemy_0 as a NonPlayerCharacter instance, this line should be: enemy_0 = NonPlayerCharacter("enemy.png", 20, 600, 50, 50) |