代码拉取完成,页面将自动刷新
import pygame
from button import *
import map_game
import ai2048
import sound
pygame.init()
# 按键颜色设置 #
buttonColorMap = [(203, 193, 182), # released
(239, 229, 219), # hovor
(242, 179, 122)] # clicked
# 按键自定义风格设置 #
#BUTTON_STYLE = {"hover_color" : buttonColorMap[1],
# "clicked_color" : buttonColorMap[2],
# "hover_sound" : pygame.mixer.Sound("./sound/sound.wav"),
# "click_sound" : pygame.mixer.Sound("./sound/clicked.wav")}
# 按键自定义风格设置 #
BUTTON_STYLE = {"hover_color" : buttonColorMap[1],
"clicked_color" : buttonColorMap[2],
"hover_sound" : pygame.mixer.Sound("./sound/hover_sound.mp3"),
"click_sound" : pygame.mixer.Sound("./sound/click_sound.mp3")
}
#基础游戏
def btnBase():
ai2048.game_state = 0 #0为手动 1为AI
map_game.start_base_game()
print("btnBase")
#AI模式
def btnAI():
ai2048.ai_button_callback()
print("btnAI")
#撤回按键
def btnReturn():
ai2048.game_state = 0 #0为手动 1为AI
#调用回调函数(位于map_game.py)
map_game.return_callback()
print("btnReturn")
#提示模式
def btnTips():
sound.tips_sound()
ai2048.tips_button_event()
print("btnTips")
#回顾模式
def btnReshow():
ai2048.reshow_callback()
print("btnReshow")
buttonBase = Button((10,90,60,40), buttonColorMap[0], btnBase, text="Start", **BUTTON_STYLE)
buttonReturn = Button((85,90,60,40), buttonColorMap[0], btnReturn, text="Return", **BUTTON_STYLE)
buttonAI = Button((160,90,60,40), buttonColorMap[0], btnAI, text="AI", **BUTTON_STYLE)
buttonTips = Button((235,90,60,40), buttonColorMap[0], btnTips, text="Tips", **BUTTON_STYLE)
buttonReshow = Button((310,90,60,40), buttonColorMap[0], btnReshow, text="Show", **BUTTON_STYLE)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。