用户:松树下的松果查看:0 回复:1 评论:0 创建时间:2021-01-19T14:05:21
【作品展示】

【作品介绍】
懒人
【作品源代码】
import random
import pygame as pg
import sys
from random import randint
import time
pg.init()
game_window = pg.display.set_mode((600,500))
pg.display.set_caption("接球游戏")
scrore = 0
font = pg.font.Font(None,60)
window_color = (0,0,0)
ball_color = (0,255,0)
rect_color = (255,0,0)
move_x = 1
move_y = 1
ball_x = random.randint(20, 580)
ball_y = random.randint(20, 480)
points = 1
count = 0
while True:
game_window.fill(window_color)
for event in pg.event.get():
if event.type==pg.QUIT:
sys.exit()
mouse_x,mouse_y=pg.mouse.get_pos()
pg.draw.circle(game_window,rect_color,(ball_x,ball_y),20)
pg.draw.rect(game_window,rect_color,(mouse_x,255,255,0)
ball_x +=move_x
ball_y +=move_y
my_score=font.render(str(score))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn