这篇文章主要介绍了python打地鼠游戏选题的需求分析,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。
Source code download: 本文相关源码
大家好,小编来为大家解答以下问题,打地鼠python程序设计说明,打地鼠游戏界面设计,今天让我们一起来看看吧!
直接上代码
import random
import sys
import os
import pygame
# 配置
CURPATH = os.getcwd()
SCREENSIZE = (993, 477)
# 锤子图片两张
HAMMER_IMAGEPATHS = [os.path.join(CURPATH, 'images/hammer0.png'),
os.path.join(CURPATH, 'images/hammer1.png')]
# 开始图片
GAME_BEGIN_IMAGEPATHS = [os.path.join(CURPATH, 'images/begin.png'),
os.path.join(CURPATH, 'images/begin1.png')]
# 重新开始图标
GAME_AAIN_IMAGEPATHS = [os.path.join(CURPATH, 'images/again1.png'),
os.path.join(CURPATH, 'images/again2.png')]
# 背景图
GAME_BG_IMAGEPATH = os.path.join(CURPATH, 'images/background.png')
# 结束背景图
GAME_END_IMAGEPATH = os.path.join(CURPATH, 'images/end.png')
MOLE_IMAGEPATHS = [os.path.join(CURPATH, 'images/mole_1.png'),
os.path.join(CURPATH, 'images/mole_laugh1.png'),
os.path.join(CURPATH, 'images/mole_laugh2.png'),
os.path.join(CURPATH, 'images/mole_laugh3.png')]
# 随机位置
HOLE_POSITIONS = [(90, -20), (405, -20), (720, -20), (90, 140), (405, 140), (720, 140), (90, 290), (405, 290),
(720, 290)]
BGM_PATH = os.path.join(CURPATH, 'audios/bgm.mp3')
# --------------------------------------------------------------------------
COUNT_DOWN_SOUND_PATH = os.path.join(CURPATH, 'audios/count_down.wav')
HAMMERING_SOUND_PATH = os.path.join(CURPATH, 'audios/hammering.wav')
FONT_PATH = os.path.join(CURPATH, 'font/Gabriola.ttf')
BROWN = (150, 75, 0)
WHITE = (255, 255, 255)
RED = (255, 0