用户:
永远的ICE查看:0 回复:3 评论:0 创建时间:2020-06-24T12:31:24
【作品展示】

【作品介绍】
hi!我是小球!我想大家都迫不及待想用python来做一个小游戏了吧!今天,就让我来教你——如何用python做一个小游戏!
代码中有解释,我就不多言了!
来!上代码!请看1
↓↓↓
【作品源代码】
print("感谢您的使用!")
print("本作品由滚动的小球制作")
print("滚动的小球 版权所有 违权必究")
print("Thank you for your use!")
print("This work is made of GDDXQ")
print("GDDXQ Copyright infringement")
import pygame
import sys # 启动第三方库
pygame.init()
screen = pygame.display.set_mode([喵0, 480])
screen.fill([0, 0, 150]) # 确定幕布具体参数
fontObj = pygame.font.Font('freesansbold.ttf', 32)
textRectobj = fontObj.render("GDDXQ Products", True, (255, 255, 255))
screen.blit(textRectobj, (0, 0)) # 加上作品名字(水印),可改
x = 100
y = 100
pygame.draw.circle(screen, [255, 0, 0], [x, y], 30, 0) # 确定球的具体参数
pygame.display.flip()
hold__down = False
ballcenter = []
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit() # 当停止运行程序,关闭第三方库
elif event.type == pygame.MOUSEBUTTONDOWN:
hold__down = True
elif event.type == pygame.MOUSEBUTTONUP:
hold__down = False
elif event.type == pygame.MOUSEMOTION:
if hold__down:
ballcenter = event.pos
screen.fill([0, 0, 150])
fontObj = pygame.font.Font('freesansbold.ttf', 32)
textRectobj = fontObj.render("GDDXQ Products", True, (255, 255, 255))
screen.blit(textRectobj, (0, 0)) # 加上作品名字(水印),可改
pygame.draw.circle(screen, [255, 0, 0], ballcenter, 30, 0)
pygame.display.flip()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn