[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Mode 7 Demo



bhaaluu wrote:
Do you have a link to landscape.bmp and sky.png?

Traceback (most recent call last):
  File "mode7.py", line 9, in ?
    ground = pygame.image.load("landscape.bmp") ## 1000x1000 works
pygame.error: Couldn't open landscape.bmp

Traceback (most recent call last):
  File "mode7.py", line 10, in ?
    sky = pygame.image.load("sky.png") ## At least 800x300
pygame.error: Couldn't open sky.png

I converted  the landscape.jpg to landscape.bmp to get the second Traceback.

This looks nice!
Arigato!


You can use any suitably-large files in place of the landscape and sky I used. But I'll put them up:
<http://kschnee.xepher.net/pics/mode7>
Just replace "landscape.bmp" with "landscape.png" in the code then.
Also, if you download the new version of the code, at:
<http://kschnee.xepher.net/code/mode7test.py>
You'll find a version that will generate crude substitutes if the files aren't found, so you can see the mode 7 effect without having the images.

Note that the landscape draws every other horizontal line, so if there are 300 lines of land drawn, you'll need at least 600 lines of actual landscape to avoid getting black areas at the bottom of the screen.

If I try using this with my tile engine (which was my source for the landscape image), I'll be generating the 2D base image on the fly rather than loading a humongous source image like this.