自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(2)
  • 资源 (3)
  • 收藏
  • 关注

原创 python编写呆呆小鸟游戏

####################引用数据库与函数###################### import pygame from random import randrange pygame.init() from time import sleep ######################定义变量########################### frame = 0 #当前在0帧处 map_width = 284 map_height = 512 #因为图片大小是284*512的 .

2021-11-10 22:50:57 4043 1

原创 用python语言编写贪吃蛇

######################定义变量############################## snake = [[0,0],[10,0],[20,0],[30,0],[40,0],[50,0]] apple_x = randrange(-20,18)*10 apple_y = randrange(-20,19)*10 aim_x = 10 aim_y = 0 ######################定义函数############################## def squ.

2021-11-09 11:33:52 760

Python写飞船小游戏(完整代码无错误)

Python写飞船小游戏完整代码。

2022-05-17

python编写呆呆小鸟程序bird.py

####################引用数据库与函数###################### import pygame from random import randrange pygame.init() from time import sleep ######################定义变量########################### frame = 0 #当前在0帧处 map_width = 284 map_height = 512 #因为图片大小是284*512的 FPS = 60 pipes = [[200,4]] bird = [40,map_height//2-50] gravity = 0.2 velocity = 0 gameScreen = pygame.display.set_mode((map_width,map_height)) clock = pygame.time.Clock() bird_wing_up = bird_wing_up_copy = pygame.image.load("images/bird_wing_up.png") bird_wing_down = bird_wing_down_copy = pygame.image.load("images/bird_wing_down.png") background = pygame.image.load("images/background.png") pipe_body = pygame.image.load("images/pipe_body.png") pipe_end = pygame.image.load("images/pipe_end.png") #######################定义函数########################## def draw_pipes(): global pipes for n in range(len(pipes)): for m in range(pipes[n][1]): gameScreen.blit(pipe_body,(pipes[n][0],m*32))#一个小管子的高度是32 for m in range(pipes[n][1]+6,16): gameScreen.blit(pipe_body, (pipes[n][0], m * 32)) gameScreen.blit(pipe_end,(pipes[n][0],pipes[n][1] * 32)) gameScreen.blit(pipe_end,(pipes[n][0],(pipes[n][1]+5) * 32)) pipes[n][0] -= 1 def draw_bird(x,y): global frame if 0<= frame < 30: gameScreen.blit(bird_wing_up, (x, y)) frame += 1 elif 30<= frame <=60: gameScreen.blit(bird_wing_down, (x, y)) frame += 1 if frame == 60: frame = 0 def safe(): if bird[1]>map_height-35: print('you die ! fw') return False if bird[1] < 0: print('you die ! fw') return False if pipes[0][0]-30 < bird[0] < pipes[0][0]+79 : if bird[1]<(pipes[0][1]+1)*32 or bird[1]>(pipes[0][1]+4)*32: print("You die ! fw") return False return True def reset(): global bird,velocity, gravity, bird_wing_down, bird_wing_up, frame, map_width, map_height, FPS, pipes

2021-11-10

python初学者贪吃蛇小游戏打包snake.exe

代码在上一条

2021-11-09

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除