更改贴图位置

This commit is contained in:
星外之神 2022-04-13 14:01:34 +08:00
parent 846d39d695
commit 36af33c562
9 changed files with 20 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -132,7 +132,7 @@ class MenuBar():
def __init__(self, card_list, sun_value):
self.loadFrame(c.MENUBAR_BACKGROUND)
self.rect = self.image.get_rect()
self.rect.x = 10
self.rect.x = 0
self.rect.y = 0
self.sun_value = sun_value

View File

@ -199,7 +199,7 @@ class Level(tool.State):
self.shovel = tool.get_image_menu(tool.GFX[c.SHOVEL], *frame_rect, c.BLACK, 1.1)
self.shovel_rect = self.shovel.get_rect()
frame_rect = [0, 0, 77, 75]
self.shovel_positon = (550, 2)
self.shovel_positon = (608, 1)
self.shovel_box = tool.get_image_menu(tool.GFX[c.SHOVEL_BOX], *frame_rect, c.BLACK, 1.1)
self.shovel_box_rect = self.shovel_box.get_rect()
self.shovel_rect.x = self.shovel_box_rect.x = self.shovel_positon[0]
@ -213,7 +213,7 @@ class Level(tool.State):
frame_rect = [0, 0, 108, 31]
self.little_menu = tool.get_image_menu(tool.GFX[c.LITTLE_MENU], *frame_rect, c.BLACK, 1.1)
self.little_menu_rect = self.little_menu.get_rect()
self.little_menu_rect.x = 650
self.little_menu_rect.x = 690
self.little_menu_rect.y = 0
frame_rect = [0, 0, 500, 500]

View File

@ -29,29 +29,29 @@ class Menu(tool.State):
def setupOption(self):
self.option_frames = []
frame_names = [c.OPTION_ADVENTURE + '_0', c.OPTION_ADVENTURE + '_1']
frame_rect = [0, 0, 165, 77]
frame_rect = [0, 0, 330, 140]
for name in frame_names:
self.option_frames.append(tool.get_image_menu(tool.GFX[name], *frame_rect, c.BLACK, 1.7))
self.option_frames.append(tool.get_image_menu(tool.GFX[name], *frame_rect, c.BLACK, 1))
self.option_frame_index = 0
self.option_image = self.option_frames[self.option_frame_index]
self.option_rect = self.option_image.get_rect()
self.option_rect.x = 435
self.option_rect.y = 75
self.option_rect.x = 400
self.option_rect.y = 60
# 退出按钮
frame_rect = [0, 0, 500, 500]
frame_rect = [0, 0, 47, 27]
self.option_exit = tool.get_image_menu(tool.GFX[c.EXIT], *frame_rect, c.BLACK, 1.1)
self.exit_rect = self.option_exit.get_rect()
self.exit_rect.x = 690
self.exit_rect.y = 400
self.exit_rect.x = 730
self.exit_rect.y = 507
# 小游戏
frame_rect = [0, 0, 317, 139]
self.option_littleGame = tool.get_image_menu(tool.GFX[c.LITTLEGAME_BUTTON], *frame_rect, c.BLACK, 0.9)
frame_rect = [0, 7, 317, 135]
self.option_littleGame = tool.get_image_menu(tool.GFX[c.LITTLEGAME_BUTTON], *frame_rect, c.BLACK, 1)
self.option_littleGame_rect = self.option_littleGame.get_rect()
self.option_littleGame_rect.x = 425
self.option_littleGame_rect.y = 200
self.option_littleGame_rect.x = 397
self.option_littleGame_rect.y = 175
self.option_start = 0
self.option_timer = 0
@ -68,8 +68,9 @@ class Menu(tool.State):
# 点击到按钮修改转态的done属性
def checkExitClick(self, mouse_pos):
x, y = mouse_pos
if(x >= self.exit_rect.x and x <= self.exit_rect.right and
y >= self.exit_rect.y and y <= self.exit_rect.bottom):
# 这里检查范围应当拟合花瓶下部整个区域
if(x >= self.exit_rect.x - 20 and x <= self.exit_rect.right + 20 and
y >= self.exit_rect.y - 5 and y <= self.exit_rect.bottom + 10):
self.done = True
self.next = c.EXIT

View File

@ -81,7 +81,7 @@ class Control():
elif event.type == pg.KEYDOWN:
self.keys = pg.key.get_pressed()
if event.key == pg.K_f:
SCREEN = pg.display.set_mode(c.SCREEN_SIZE, pg.FULLSCREEN)
SCREEN = pg.display.set_mode(c.SCREEN_SIZE, pg.HWSURFACE|pg.FULLSCREEN)
elif event.key == pg.K_u:
SCREEN = pg.display.set_mode(c.SCREEN_SIZE)
elif event.type == pg.KEYUP:
@ -143,12 +143,12 @@ def load_image_frames(directory, image_name, colorkey, accept):
tmp[index]= img
frame_num += 1
for i in range(frame_num):
for i in range(frame_num): # 这里注意编号必须连续,否则会出错
frame_list.append(tmp[i])
return frame_list
# colorkeys 是设置图像中的某个颜色值为透明,这里用来消除白边
def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '.gif')):
def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '.gif', 'webp')):
graphics = {}
for name1 in os.listdir(directory):
# subfolders under the folder resources\graphics