用户:123456789QiGR查看:0 回复:0 评论:0 创建时间:2023-07-17T19:33:02
【作品展示】

【作品介绍】
好玩
【作品源代码】
import pygame
WIDTH=800
HEIGHT=400
ball=Actor("ball.png")
ball1=Actor("ball.png")
ball.x= WIDTH/2
ball.y=HEIGHT/2
ball1.x= WIDTH/2
ball1.y=HEIGHT/2
ball.speed_x = 5
ball1.speed_y = 5
#pgzrun
def update():
#ball.x +=2
ball.x +=ball.speed_x
ball1.y +=ball1.speed_y
if ball.right>=WIDTH:
ball.speed_x=-ball.speed_x
if ball.left<=0:
ball.speed_x=-ball.speed_x
if ball1.top<=0:
ball1.speed_y=-ball1.speed_y
if ball1.bottom>=HEIGHT:
ball1.speed_y=-ball1.speed_y
def draw():
screen.fill((160,220,255))
ball.draw()
ball1.draw()
pygame.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn