obiwac / python-minecraft-clone

Source code for each episode of my Minecraft clone in Python YouTube tutorial series.
https://www.youtube.com/playlist?list=PL6_bLxRDFzoKjaa3qCGkwR5L_ouSreaVP
MIT License
162 stars 79 forks source link

a blank black window #86

Closed aniketm32012 closed 1 year ago

aniketm32012 commented 1 year ago

the window opens up but with a blank window and there's not even a block in the window. the resize statement is printed but not the fps on. It started when I completed ep 11.

obiwac commented 1 year ago

You're probably loading the chunks incorrectly. Are you sure you're running the same code as on this repo?

aniketm32012 commented 1 year ago

Yes I copied the code from your GitHub rep

obiwac commented 1 year ago

but you're saying episode 10 works?

aniketm32012 commented 1 year ago

Yes, it works. Using windows 11 python v- 3.9.

aniketm32012 commented 1 year ago

I am using intellij idea IDE, latest version.

aniketm32012 commented 1 year ago

i have created this repo for you to help by searching errors - https://github.com/aniketm32012/python-minecraft-clone-ep-11.

obiwac commented 1 year ago

It's not exactly the same. Yours is missing the textures/mossy_cobblestone.png file. You shouldn't be getting a blank window, but the following error message telling you this much:

Traceback (most recent call last):
  File "/tmp/python-minecraft-clone-ep-11/main.py", line 164, in <module>
    game = Game()
  File "/tmp/python-minecraft-clone-ep-11/main.py", line 158, in __init__
    self.window = Window(config = self.config, width = 800, height = 600, caption = "Minecraft clone", resizable = True, vsync = False)
  File "/tmp/python-minecraft-clone-ep-11/main.py", line 29, in __init__
    self.world = world.World()
  File "/tmp/python-minecraft-clone-ep-11/world.py", line 63, in __init__
    _block_type = block_type.Block_type(self.texture_manager, name, texture, model)
  File "/tmp/python-minecraft-clone-ep-11/block_type.py", line 34, in __init__
    texture_manager.add_texture(texture)
  File "/tmp/python-minecraft-clone-ep-11/texture_manager.py", line 34, in add_texture
    texture_image = pyglet.image.load(f"textures/{texture}.png").get_image_data()
  File "/home/obiwac/.local/lib/python3.9/site-packages/pyglet/image/__init__.py", line 177, in load
    file = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'textures/mossy_cobblestone.png'

That may simply be a mistake in uploading the files - I'd advise you to learn about using Github Desktop or similar - but I'm still unsure then of if you've actually cloned this repository and tried running episode-11.

aniketm32012 commented 1 year ago

Thanks, let me rearrange everything.

aniketm32012 commented 1 year ago

I did not have that thanks bro.