import random
import pygame
import sys
def figure(screen, photo, x, y):
content = pygame.image.load(photo)
screen.blit(content, (x, y))
def ziti(screen, text, x, y, size = 24,color=(232, 206, 144)):
font = pygame.font.Font(“ziti.ttf”, size)
img_text = font.render(text, True, color) # 设置文字参数,内容,锯齿话,颜色
screen.blit(img_text, (x, y)) # 将文字放在屏幕上
def run():
screen_w, screen_h = 640, 480
score = 0
hp = 3
speed = 1
ball_x, ball_y = 400, 0
ban_x, ban_y, ban_width, ban_height = 400, screen_h - 40, 220, 100
bg_volume = 0.9
sound_volume = 0.4
start = “请点击开始游戏”
result = “”
title = “接亚瑟”
sound_score = “C:/Users/Administrator/Desktop/涂博仁编程文件夹(只能用Python打开的程序)/hit_wall.wav”
ball_figure = “yase.png”
bj_figure = “bj.jpg”
bg_music = “bj.mp3”
ban =“ban5.png”
game_over = True
检测按键是不是按着不放
moving_left = False
moving_right = False
moving_up = False
moving_down = False
screen = pygame.display.set_mode((screen_w, screen_h)) # 2.创建一个窗口,设置大小
pygame.display.set_caption(title)
hit = pygame.mixer.Sound(sound_score) # 加载音乐
hit.set_volume(sound_volume) # 设置音量
pygame.mixer.music.load(bg_music)
pygame.mixer.music.set_volume(bg_volume)
pygame.mixer_music.play(-1)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONUP:
if game_over:
game_over = False
score = 0
hp = 4
elif event.type == pygame.MOUSEMOTION:
ban_x, _ = event.pos
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_a or event.key == pygame.K_LEFT:
moving_left = True
最后
硬核资料:关注即可领取PPT模板、简历模板、行业经典书籍PDF。 技术互助:技术群大佬指点迷津,你的问题可能不是问题,求资源在群里喊一声。 面试题库:由技术群里的小伙伴们共同投稿,热乎的大厂面试真题,持续更新中。 知识体系:含编程语言、算法、大数据生态圈组件(Mysql、Hive、Spark、Flink)、数据仓库、Python、前端等等。
小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Python工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Python爬虫全套学习资料》送给大家,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注:python)
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注:python) [外链图片转存中…(img-uWVcKt3y-1711179308924)]
参考阅读
发表评论