用户:
ZCH幻影深渊查看:0 回复:0 评论:0 创建时间:2020-04-07T14:46:53
【作品展示】

【作品介绍】
hh
【作品源代码】
import pygame
import sys
import time
import random
pygame.init()
pygame.font.init()
Yes = 10
guanshu = 1
while True:
game_loop = 0
loop_update = 10
loop_p = 40
point = 0
New_point = 1
count = 0
ball_x = random.randint(20, 580)
ball_y = 20
ball_color = 255, 200, 0
ball_move_x = 1
ball_move_y = 1
flat_x = 250
flat_color = 255, 0, 0
flat_moving = 0
print("游戏马上要开shile")
time.sleep(3)
screen = pygame.display.set_mode((600, 500))
title = pygame.display.set_caption("弹球游戏")
kkk = pygame.font.SysFont("SimHei", 80)
kkk = kkk.render("第"+str(guanshu)+"关", False, (200, 0, 0))
screen.blit(kkk, (180, 250))
pygame.display.update()
time.sleep(5)
screen.fill((0, 0, 255))
while True:
if game_loop > loop_p:
for e in pygame.event.get():
if e.type == pygame.QUIT:
pygame.quit()
sys.exit()
ball_x += ball_move_x
ball_y += ball_move_y
if ball_x > 580 or ball_x < 20:
ball_move_x = -ball_move_x
if ball_y < 20:
ball_move_y = -ball_move_y
if ball_y > 480:
kkk = pygame.font.SysFont("SimHei", 80)
kkk = kkk.render("啊哦!闯关失败", False, (200, 0, 0))
screen.blit(kkk, (50, 250))
pygame.display.update()
time.sleep(3)
break
if point > Yes:
kkk = pygame.font.SysFont("SimHei", 80)
kkk = kkk.render("恭喜!过关", False, (200, 0, 0))
screen.blit(kkk, (100, 250))
pygame.display.update()
time.sleep(3)
Yes += Yes/3
guanshu += 1
break
if flat_x - 20 < ball_x and ball_x < flat_x + 120 and ball_y >= 470:
ball_move_y = -ball_move_y
point += New_point
count += 1
if count == 3:
count = 0
New_point += New_point/4
loop_p -= loop_p/4
flat_x, kkk = pygame.mouse.get_pos()
game_loop = 0
game_loop += loop_update
screen.fill((0, 0, 255))
ball = pygame.draw.circle(screen, ball_color, (ball_x, ball_y), 25, 0)
flat = pygame.draw.rect(screen, flat_color, (flat_x, 490, 100, 10), 0)
kkk = pygame.font.SysFont("微软雅黑", 60)
kkk = kkk.render(str(int(point)), False, (255, 255, 255))
screen.blit(kkk, (500, 30))
pygame.display.update()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn