赞
踩
关注小编,私信小编领取哟!
当然别忘了一件三连哟~~
公众号:Python日志
可以关注小编公众号,会不定时的发布一下Python小技巧,还有很多资源可以免费领取哟!!
源码领取:加Python学习交流群:773162165 可以领取哟
Python版本:3.7.8
相关模块:
pygame模块;
random模块;
pyttsx3模块;
以及一些python自带的模块。
安装Python并添加到环境变量,pip安装需要的相关模块即可。
效果展示
部分代码展示
def myinit(): screen = pygame.display.set_mode((769,563)) g1 = pygame.image.load("g1.jpg").convert() g2 = pygame.image.load("hh.png").convert() t = 0 timer = pygame.time.Clock() while(1): timer.tick(30) ticks = pygame.time.get_ticks(); for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() screen.blit(g1,(0,0)) t+= 1 print(t) if t > 66: break; pygame.display.update() while(1): timer.tick(30) ticks = pygame.time.get_ticks(); for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type == MOUSEBUTTONUP: mouse_up = event.button mouse_up_x,mouse_up_y = event.pos if mouse_up_x > 245 and mouse_up_x < 469 and mouse_up_y> 368 and mouse_up_y < 470: return screen.blit(g2,(0,0)) pygame.display.update() if __name__ == '__main__': pygame.init() screen = pygame.display.set_mode((1200, 800)) pygame.display.set_caption("简单足球 公众号:Python日志 源码领取学习交流群:773162165") font = pygame.font.Font(None, 36) myinit() timer = pygame.time.Clock() n1 = 0 n2 =0 screen = pygame.display.set_mode((1200, 800)) for x in range(10000): t = begin_a_game(n1,n2); if t == 1: n1 +=1 else: n2 += 1
效果展示
部分代码展示
import pygame as pg from .. import tools from .. import constants as c class MainMenu(tools._State): def __init__(self): super(MainMenu, self).__init__() self.reset_game_info() self.startup(0.0, self.persist) def startup(self, current_time, persist): #self.game_info = persist #self.persist = self.game_info self.next = c.CHOOSING self.state = c.PLAY self.setup_background() #self.setup_cursor()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。