资源简介

使用pygame+python设计小游戏,主要功能有战机购买与选择,关卡的选择.

资源截图

代码片段和文件信息

import pygame
import random

#窗口
screen = None
#时钟
clock = None
#标题
CAPTION=‘飞机大战‘

SCREEN_SIZE=(512768)

#关卡图片的坐标(interface)
LEVEL_lIST=[(3068)(30208)(30348)(30488)(30628)]

#爆炸图片路径
BOOM=[
    ‘./images/boom/boom_1.png‘
    ‘./images/boom/boom_2.png‘
    ‘./images/boom/boom_3.png‘
    ‘./images/boom/boom_4.png‘
    ‘./images/boom/boom_5.png‘
    ‘./images/boom/boom_6.png‘
]

#存储每个关卡的surface对象
LEVEL_RECT=[]

#背景图片列表
BACKGROUND=[
    ‘./images/maps/img_bg_level_1.jpg‘
    ‘./images/maps/img_bg_level_2.jpg‘
    ‘./images/maps/img_bg_level_3.jpg‘
    ‘./images/maps/img_bg_level_4.jpg‘
    ‘./images/maps/img_bg_level_5.jpg‘
]

BG_MENUS=‘./images/ui/bg_menu.bmp‘

START_MENUS=‘./images/ui/start_menu.png‘

LEFT=‘./images/ui/left.png‘

RIGHT=‘./images/ui/right.png‘

UI_LEVEL=[
    ‘./images/ui/level_1.jpg‘
    ‘./images/ui/level_2.jpg‘
    ‘./images/ui/level_3.jpg‘
    ‘./images/ui/level_4.jpg‘
    ‘./images/ui/level_5.jpg‘
]

UI_GAME_COMPLETE=‘./images/ui/game_complete.png‘

INDEX_PATH=‘./images/ui/index.jpg‘

PLAY_IMAGE=‘./images/ui/play.png‘

UI_BACK=‘./images/ui/back.png‘

INTERFACE=‘./images/ui/interface.jpg‘

UI_PURCHASE=‘./images/ui/goumai.png‘
#hero 图片路径
HERO=[
    ‘./images/hero/hero_1.png‘
    ‘./images/hero/hero_2.png‘
    ‘./images/hero/hero_3.png‘
    ‘./images/hero/hero_4.png‘
]
#bullet 图片路径(前三个为hero子弹)
BULLET=[
    ‘./images/bullet/bullet_1.png‘
    ‘./images/bullet/bullet_2.png‘
    ‘./images/bullet/bullet_3.png‘
    ‘./images/bullet/bullet_4.png‘
    ‘./images/bullet/bullet_5.png‘
]
#enemy 图片路径

ENEMYS={
    1:[
        ‘./images/enemy/boss_1.png‘
        ‘./images/enemy/a1_1.png‘
        ‘./images/enemy/a1_2.png‘
    ]
    2:[
        ‘./images/enemy/boss_2.png‘
        ‘./images/enemy/a2_1.png‘
        ‘./images/enemy/a2_2.png‘
    ]
    3:[
        ‘./images/enemy/boss_3.png‘
        ‘./images/enemy/a3_1.png‘
        ‘./images/enemy/a3_2.png‘
    ]
    4:[
        ‘./images/enemy/boss_4.png‘
        ‘./images/enemy/a4_1.png‘
        ‘./images/enemy/a4_2.png‘
    ]
    5:[
        ‘./images/enemy/boss_5.png‘
        ‘./images/enemy/a5_1.png‘
        ‘./images/enemy/a5_2.png‘
    ]
}

ENENY_REWARD=‘./images/ui/life.png‘

SOUND_INDEX=‘./sound/index.wav‘
#爆炸音效
SOUND_BOOM=‘./sound/boom.wav‘
#子弹音效
SOUND_BULLET=‘./sound/bullet.wav‘
#背景音效
SOUND_BG=‘./sound/game_music.wav‘
#game_over
GAME_OVER=‘./sound/game_over.wav‘
#game_complete
GAME_COMPLETE=‘./sound/game_complete.wav‘

#初始HP
HP=50

#自定义事件
EVENT_BOSS_CREATE=pygame.USEREVENT
EVENT_COMMON_CREATE=pygame.USEREVENT+1
#自定义事件列表
EVENTLIST=[EVENT_BOSS_CREATEEVENT_COMMON_CREATE]


pygame.time.set_timer(EVENT_BOSS_CREATE random.randint(4000 5500))
pygame.time.set_timer(EVENT_COMMON_CREATE random.randint(1000 2000))

ATK=None


SCORE_STR=‘score:0‘

#surface列表
SURFACE_LIST=dict()

#敌机子弹
ENEMY_BULLET=‘./images/en

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3222  2018-08-10 13:10  pygame小游戏\config.py

     文件      13624  2018-08-10 13:11  pygame小游戏\engine.py

     文件      12553  2014-02-18 16:14  pygame小游戏\font\arial-14.fnt

     文件      25776  2014-02-18 16:14  pygame小游戏\font\font.ttf

     文件       3859  2018-08-06 16:38  pygame小游戏\images\boom\boom_1.png

     文件       5303  2018-08-06 16:38  pygame小游戏\images\boom\boom_2.png

     文件       4763  2018-08-06 16:38  pygame小游戏\images\boom\boom_3.png

     文件       4400  2018-08-06 16:38  pygame小游戏\images\boom\boom_4.png

     文件       4592  2018-08-06 16:38  pygame小游戏\images\boom\boom_5.png

     文件       3009  2018-08-06 16:38  pygame小游戏\images\boom\boom_6.png

     文件       4679  2018-08-04 16:34  pygame小游戏\images\bullet\bullet_1.png

     文件       4565  2018-08-04 16:34  pygame小游戏\images\bullet\bullet_2.png

     文件       4850  2018-08-04 16:34  pygame小游戏\images\bullet\bullet_3.png

     文件       5301  2018-08-09 17:47  pygame小游戏\images\bullet\bullet_4.png

     文件       3479  2018-08-06 11:38  pygame小游戏\images\bullet\bullet_5.png

     文件       5310  2018-08-04 16:31  pygame小游戏\images\enemy\a1_1.png

     文件       5251  2018-08-04 16:31  pygame小游戏\images\enemy\a1_2.png

     文件       5048  2018-08-04 16:32  pygame小游戏\images\enemy\a2_1.png

     文件       5280  2018-08-04 16:32  pygame小游戏\images\enemy\a2_2.png

     文件       5042  2018-08-04 16:33  pygame小游戏\images\enemy\a3_1.png

     文件       6697  2018-08-08 12:12  pygame小游戏\images\enemy\a3_2.png

     文件       5322  2018-08-04 16:33  pygame小游戏\images\enemy\a4_1.png

     文件       6524  2018-08-08 12:07  pygame小游戏\images\enemy\a4_2.png

     文件       6691  2018-08-08 12:13  pygame小游戏\images\enemy\a5_1.png

     文件       6696  2018-08-08 12:10  pygame小游戏\images\enemy\a5_2.png

     文件      29100  2018-08-06 15:25  pygame小游戏\images\enemy\boss_1.png

     文件      26107  2018-08-06 11:59  pygame小游戏\images\enemy\boss_2.png

     文件      24835  2018-08-06 11:59  pygame小游戏\images\enemy\boss_3.png

     文件      19752  2018-08-06 11:59  pygame小游戏\images\enemy\boss_4.png

     文件      29790  2018-08-06 11:59  pygame小游戏\images\enemy\boss_5.png

............此处省略65个文件信息

评论

共有 条评论