关于pygame的飞机大战源码快捷引用
勿喷勿喷小甲鱼的“带你学pygame带你飞”
https://www.bilibili.com/video/BV1XN4y1L7HG?spm_id_from=333.999.0.0&vd_source=d598216e52ea153ab83bc8fcee3beebf
给新人的资料
static/image/hrline/line4.png
原网站
https://github.com/techwithtim/PygameForBeginners
用里面的素材做了一个旧版的python教程的pygame的第一个小程序
import pygame
import sys
pygame.init()
bg = (255,255,55)
size= oh,ho = 960,510
oho=
bull=1
#创建窗口
s = pygame.display.set_mode(size)
full=False
ratio = 1
space = pygame.image.load("space.png")
onn = pygame.image.load("spaceship_red.png" )
nn = onn
onn_rect=onn.get_rect()
d = nn_rect = onn.get_rect()
c = space.get_rect()
while True:
for oo in pygame.event.get():
if oo.type == pygame.QUIT:
sys.exit()
if oo.type == pygame.KEYDOWN:
if oo.key == pygame.K_LEFT:
oho=[-10,0]
d=d.move(oho)
bull=bull+1
if oo.key == pygame.K_RIGHT:
oho=
d=d.move(oho)
bull=bull+1
if oo.key == pygame.K_UP:
oho=
d=d.move(oho)
bull=bull+1
if oo.key == pygame.K_DOWN:
oho=
d=d.move(oho)
bull=bull+1
if oo.key ==pygame.K_F11:
full = not full
if full:
size= oh,ho = 1920,1080
s = pygame.display.set_mode(size,pygame.FULLSCREEN | pygame.HWSURFACE)
else:
size= oh,ho = 960,510
s = pygame.display.set_mode(size)
if oo.key == pygame.K_EQUALS or oo.key == pygame.K_MINUS or oo.key == pygame.K_SPACE:
if oo.key ==pygame.K_EQUALS and ratio <2:
ratio =ratio+0.1
if oo.key ==pygame.K_MINUS and ratio >0.5:
ratio =ratio-0.1
if oo.key ==pygame.K_SPACE:
ratio=1.0
nn=pygame.transform.smoothscale(onn, \
(int(onn_rect.width * ratio), \
int(onn_rect.height * ratio)))
if d.left < 0 or d.right > oh:
oho = -oho
if d.top < 0 or d.bottom > ho:
oho = -oho
s.blit(nn,d)
pygame.display.flip()
s.fill(bg)
print(bull)
{:10_266:}{:10_266:}{:10_266:}
怎么没有人回复哪{:10_247:}{:10_247:}
页:
[1]