有大佬对Mu编辑器熟悉的吗,用python语言在Mu上用游戏模式写了一个扫雷游戏,在64位的版本上运行良好(win10的电脑),但是拿到32位系统的版本上(win7的电脑)就报错找不到指定图片(图片确认过在相应目录图片确认过在相应目录下,格式没问题),求大佬指点!
报错如下:
"No 'images' directory found to load image 'minesweep_block'."
import random
BOMBS=10
ROWS=20
COLS=20
SIZE=35
WIDTH=SIZE*COLS
HEIGHT=SIZE*ROWS
failed=False
finished=False
blocks=[]
for i in range(ROWS):
for j in range(COLS):
block=Actor("minesweep_block")
block.left=j*SIZE
block.top=i*SIZE
block.isbomb=False
block.isopen=False
block.isflag=False
blocks.append(block)
random.shuffle(blocks)
for i in range(BOMBS):
blocks[i].isbomb=True
def update():
global finished
if finished or failed:
return
for block in blocks:
if not block.isbomb and not block.isopen:
return
finished=True
sounds.tiancai.play()
def draw():
screen.fill((200,100,100))
for block in blocks:
block.draw()
if finished:
screen.draw.text("Finished",center=(WIDTH//2,HEIGHT//2),fontsize=100,color="red")
elif failed:
screen.draw.text("Failed",center=(WIDTH//2,HEIGHT//2),fontsize=100,color="red")
def on_mouse_down(pos,button):
if failed or finished:
return
for block in blocks:
if block.collidepoint(pos) and not block.isopen:
if button==mouse.RIGHT:
set_flag(block)
elif button==mouse.LEFT and not block.isflag:
if block.isbomb:
blow_up()
else:
open_block(block)
def set_flag(block):
if not block.isflag:
block.image="minesweep_flag"
block.isflag=True
else:
block.image="minesweep_block"
block.isflag=False
def blow_up():
global failed
failed=True
sounds.dawaile.play()
for i in range(BOMBS):
blocks[i].image="minesweep_bomb"
def open_block(bk):
bk.isopen=True
bombnum=get_bomb_number(bk)
bk.image="minesweep_number"+str(bombnum)
if bombnum !=0:
return
for block in get_neighbours(bk):
if not block.isopen:
open_block(block)
def get_bomb_number(bk):
num=0
for block in get_neighbours(bk):
if block.isbomb:
num+=1
return num
def get_neighbours(bk):
nblocks=[]
for block in blocks:
if block.isopen:
continue
if block.x==bk.x-SIZE and block.y==bk.y \
or block.x==bk.x+SIZE and block.y==bk.y \
or block.x==bk.x and block.y==bk.y-SIZE \
or block.x==bk.x and block.y==bk.y+SIZE \下,格式没问题)
import random
BOMBS=10
ROWS=20
COLS=20
SIZE=35
WIDTH=SIZE*COLS
HEIGHT=SIZE*ROWS
failed=False
finished=False
blocks=[]
for i in range(ROWS):
for j in range(COLS):
block=Actor("minesweep_block")
block.left=j*SIZE
block.top=i*SIZE
block.isbomb=False
block.isopen=False
block.isflag=False
blocks.append(block)
random.shuffle(blocks)
for i in range(BOMBS):
blocks[i].isbomb=True
def update():
global finished
if finished or failed:
return
for block in blocks:
if not block.isbomb and not block.isopen:
return
finished=True
sounds.tiancai.play()
def draw():
screen.fill((200,100,100))
for block in blocks:
block.draw()
if finished:
screen.draw.text("Finished",center=(WIDTH//2,HEIGHT//2),fontsize=100,color="red")
elif failed:
screen.draw.text("Failed",center=(WIDTH//2,HEIGHT//2),fontsize=100,color="red")
def on_mouse_down(pos,button):
if failed or finished:
return
for block in blocks:
if block.collidepoint(pos) and not block.isopen:
if button==mouse.RIGHT:
set_flag(block)
elif button==mouse.LEFT and not block.isflag:
if block.isbomb:
blow_up()
else:
open_block(block)
def set_flag(block):
if not block.isflag:
block.image="minesweep_flag"
block.isflag=True
else:
block.image="minesweep_block"
block.isflag=False
def blow_up():
global failed
failed=True
sounds.dawaile.play()
for i in range(BOMBS):
blocks[i].image="minesweep_bomb"
def open_block(bk):
bk.isopen=True
bombnum=get_bomb_number(bk)
bk.image="minesweep_number"+str(bombnum)
if bombnum !=0:
return
for block in get_neighbours(bk):
if not block.isopen:
open_block(block)
def get_bomb_number(bk):
num=0
for block in get_neighbours(bk):
if block.isbomb:
num+=1
return num
def get_neighbours(bk):
nblocks=[]
for block in blocks:
if block.isopen:
continue
if block.x==bk.x-SIZE and block.y==bk.y \
or block.x==bk.x+SIZE and block.y==bk.y \
or block.x==bk.x and block.y==bk.y-SIZE \
or block.x==bk.x and block.y==bk.y+SIZE \
or block.x==bk.x-SIZE and block.y==bk.y-SIZE \
or block.x==bk.x+SIZE and block.y==bk.y-SIZE \
or block.x==bk.x-SIZE and block.y==bk.y+SIZE \
or block.x==bk.x+SIZE and block.y==bk.y+SIZE:
nblocks.append(block)
return nblocks