关于pygame怎么使用
我在cmd上已经安装了pygame了并且安装了python
那么 怎么用它们编写一个游戏呢?是要用一个软件吗?
我安装了sublime text3 用它编写吗?
那么怎么运行呢?
今天接触python
求大佬解答下
import pygame pygame.init() screen = pygame.display.set_mode([1000,1000]) running=True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False pygame.quit()
import pygame,time pygame.init() sc = pygame.display.set_mode((1000,1000)) s=1 sc.fill((100,100,100)) pygame.display.update() font = pygame.font.SysFont("宋体",80,True) tr = font.render("倒计时开始: "+str(),True,(255,0,0)) sc.blit(tr,(160,220)) pygame.display.update() while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: s=s+1 sc.fill((100,100,100)) pygame.display.update() font = pygame.font.SysFont("宋体",80,True) tr = font.render("倒计时开始: "+str(s),True,(255,0,0)) sc.blit(tr,(160,220)) pygame.display.update() elif event.key == pygame.K_RIGHT: s=s-1 sc.fill((100,100,100)) pygame.display.update() font = pygame.font.SysFont("宋体",80,True) tr = font.render("倒计时开始: "+str(s),True,(255,0,0)) sc.blit(tr,(160,220)) pygame.display.update() #elif event.key == pygame.K_UP: #y-=1 elif event.key == pygame.K_RETURN: for d in range(s): s=s-1 sc.fill((100,100,100)) pygame.display.update() font = pygame.font.SysFont("宋体",80,True) tr = font.render("倒计时开始: "+str(s),True,(255,0,0)) sc.blit(tr,(160,220)) pygame.display.update() time.sleep(1) #s=s-1 if s==0: zhb = pygame.image.load('C:\\mxcmaterials\\l8_05_boom-5759302b-ebff-49fb-8208-59d82b58b7d1.png') sc.blit(zhb,(0,0)) pygame.display.update() #time.sleep(0.1) font = pygame.font.SysFont("宋体",80,True) tr = font.render("倒计时开始: "+str(),True,(255,0,0)) sc.blit(tr,(160,220)) pygame.display.update() running=True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False pygame.quit()
[此贴子已经被作者于2020-2-29 22:07编辑过]