问题描述
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))
我遇到了一个问题,因为某种原因画布在屏幕中间被切断了。
我遇到的另一个问题是文件末尾的 pgzrun.go()
,这会导致程序崩溃并出现以下错误:
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'
我尝试修改画布和屏幕的分辨率值,甚至是精灵本身的位置。我将画布拖到屏幕上,而不是直接在屏幕上绘制,因为如果我是对的,它应该能让我更轻松地添加滚动。
我感谢任何人能给我的任何帮助。
编辑:代码在这里https://paste.pythondiscord.com/tetogequze.py
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)