screen = pygame.display.set_mode((WIDTH,HEIGHT))
canvas = pygame.Surface((WIDTH,HEIGHT))
def makefunnytiles(saice):
global WIDTH
global HEIGHT
global screen
global roomdata
global tiledefinitions
print("Baking Tiles")
print(roomdata)
index = 0
index2 = 0
for symbolic in saice:
index2 = 0
symbolic = symbolic.strip()
print("sanity")
for symbol in list(symbolic):
print(symbol)
if symbol in tiledefinitions:
canvas.blit(pygame.image.load("sprites/" + str(roomdata['area']) + "/" + str(tiledefinitions[symbol]) + ".png").convert_alpha(), ((32 * index2),(32 * index)))
index2 += 1
index += 1
screen.blit(canvas, (0,0))
pygame.display.flip()
print("drew screen")
print(str(canvas.get_width))
I'm having a problem with this where for some reason the canvas cuts off at the middle of the screen.
Another problem I'm having is that pgzrun.go()
at the end of the file, which crashes the program with this error:
Traceback (most recent call last):
File "C:\Users\RushVisor\Documents\Glamore\main.py", line 100, in <module>
pgzrun.go()
File "E:\Python39\lib\site-packages\pgzrun.py", line 31, in go
run_mod(mod)
File "E:\Python39\lib\site-packages\pgzero\runner.py", line 113, in run_mod
PGZeroGame(mod).run()
File "E:\Python39\lib\site-packages\pgzero\game.py", line 217, in run
self.mainloop()
File "E:\Python39\lib\site-packages\pgzero\game.py", line 225, in mainloop
self.reinit_screen()
File "E:\Python39\lib\site-packages\pgzero\game.py", line 73, in reinit_screen
self.mod.screen.surface = self.screen
AttributeError: 'pygame.Surface' object has no attribute 'surface'
I've tried modifying the resolution values for both canvas and screen and even the sprite's positions themselves. I am blitting the canvas to the screen rather than drawing to the screen directly because if I'm right it should allow me to add scrolling easier.
I appreciate any help anyone can give me.
EDIT: Code is here https://paste.pythondiscord.com/tetogequze.py