代码区:
import pygame.display
from pygame import *
#设置窗口大小
SCREEN_WIDTH = 700
SCREEN_HEIGHT = 500
# 设置颜色
BG_COLOR = pygame.Color(0,0,0)
# 主类
class MainGme():
def __init__(self):
pass
# 开始游戏
def startGame(self):
pass
# 加载化窗口
# 初始主窗口
pygame.display.init()
#设置窗口
MainGme.window = pygame.display.set_mode([SCREEN_WIDTH,SCREEN_HEIGHT])
#设置窗口标题
pygame.display.set_caption("坦克大战初版")
while True:
#设置填充色
MainGme.window.fill(BG_COLOR)
#窗口一直显示
pygame.display.update()
# 结束游戏
def endGame(self):
pass
# 我方坦克
# class Mytank(Tank):
# def __init__(self):
# pass
# # 敌方坦克
# class EnemyTank(Tank):
# def __init__(self):
# pass
# 子弹类
class Bullet():
def __init__(self):
pass
# 墙壁类
class Wall():
def __init__(self):
pass
# 爆炸效果
# 音效运行结果:
pygame 2.0.1 (SDL 2.0.14, Python 3.9.6) Hello from the pygame community. https://www.pygame.org/contribute.html