Click here to Skip to main content
15,900,669 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i was doing the zelda game python tutorial

i have encountered this problem
since i am sorta of a begginer in pygame idk how to deal with problems pls help

Traceback (most recent call last):
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\main.py", line 31, in <module>
    game = Game()
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\main.py", line 15, in __init__
    self.level = Level()
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\level.py", line 17, in __init__
    self.create_map()
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\level.py", line 27, in create_map
    Tile((x, y), [self.visible_sprites])
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\tile.py", line 7, in __init__
    super().__init__(groups)
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\venv\lib\site-packages\pygame\sprite.py", line 116, in __init__
    self.add(*groups)
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\venv\lib\site-packages\pygame\sprite.py", line 134, in add
    self.add(*group)
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\venv\lib\site-packages\pygame\sprite.py", line 131, in add
    group.add_internal(self)
TypeError: AbstractGroup.add_internal() missing 1 required positional argument: 'sprite'


What I have tried:

i tried my best to fix things

i first fixed a super().__init__()
problem but i cant understand whats goin on now
Posted
Updated 5-Sep-22 21:31pm

1 solution

Python
  File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\venv\lib\site-packages\pygame\sprite.py", line 131, in add
    group.add_internal(self)
TypeError: AbstractGroup.add_internal() missing 1 required positional argument: 'sprite'

Look at the error message: the call to add_internal is supposed to pass a sprite as one of its parameters, but that is missing. So go back to the code at
Python
File "C:\Users\JJJbr\PycharmProjects\Zelda Practice\tile.py", line 7, in __init__
  super().__init__(groups)

Whatever you are passing in the groups parameter, something is missing. The documentation should explain what that is.
 
Share this answer
 
Comments
XA26 Jason Immanuel 6-Sep-22 3:39am    
idk hmm
https://youtu.be/QU1pPzEGrqw
i am watching in between 20-26 minutes i saw the file given by the tutorial its the same :(
Richard MacCutchan 6-Sep-22 3:46am    
Sorry, I have no idea what Zelda is. If you do not understand it then you need to talk to the people who wrote it.
CPallini 6-Sep-22 3:55am    
As everybody knows, Zelda is the Twilight Princess!
5.
Richard MacCutchan 6-Sep-22 4:10am    
When you say "everybody", you forget that some of us are no longer teenagers. :(
Richard MacCutchan 6-Sep-22 4:14am    
Here's a little additional advice:
1. Learn Python in detail: The Python Tutorial — Python 3.10.6 documentation[^].
2. Learn PyGame ditto: tutorials - pygame wiki[^].
3. Don't waste time trying to learn from YouTube videos.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900