会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132360个问题
Python 全系列/第二阶段:Python 深入与提高/文件处理 526楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 527楼

image.png

Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 528楼
Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 530楼

'''

load game window

'''


import pygame

# define constants

SCREEN_WIDTH=700

SCREEN_HEIGHT=500

BG_COLOR=pygame.Color(255,255,255)

#from curses import window

class MainGame():

    window=None

    # initialization method

    def __init__(self) -> None:

        pass

    # start game

    def startGame(self):

        #initialize the window

        pygame.display.init()

        #set the size of window

        MainGame.window=pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

        # set the title of window

        pygame.display.set_caption("tank war1.03")

        while True:

            # set the fill color for the window

            MainGame.window.fill(BG_COLOR)

            pygame.display.update


    # end game

    def endGame(self):

        pass


class Tank():

    def __init__(self) -> None:

        pass

    #defition of show tank

    def displayTank(self):

        pass


    #movement of tank

    def move(self):

        pass


    #shoot

    def shot(self):

        pass



#our tank

class MyTank(Tank):

    #initialization method

    def __init__(self) -> None:

        pass


#enemy tank

class EnemyTank(Tank):

    def __init__(self) -> None:

        pass


# class bullet

class Bullet():

    def __init__(self) -> None:

        pass


    #show bullet

    def displayBullet(self):

        pass


    #move

    def move(self):

        pass


# class wall

class Wall():

    def __init__(self) -> None:

        pass


    # the defition of show wall

    def displayWall(self):

        pass

# class explosion effect

class Explode():

    def __init__(self) -> None:

        pass


    #display the effect of explosion

    def displayExplode(self):

        pass



#class of sound effect

class Music():

    def __init__(self) -> None:

        pass


    #play music

    def playMusic(self):

        pass


# main method

if __name__ =='__main__':

    # call startGame() in the main class

    MainGame().startGame()



为什么我这窗口还是黑色的

image.png


Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 532楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 533楼
Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 534楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 535楼
Python 全系列/第二阶段:Python 深入与提高/(旧)坦克大战 536楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 537楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 538楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 539楼
Python 全系列/第二阶段:Python 深入与提高/模块 540楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637