"""
图章粒子效果,
海龟画图的图章是静止的,可本程序实现了移动它。
并且碰到它缘它还会自动消失。
"""
from sprites import *
from random import *
screen = Screen()
screen.tracer(0,0)
screen.bgcolor('black')
screen.setup(600,600)
ball = Sprite(shape='circle',visible=False)
ball.color('yellow')
ball.scale(0.05)
velocity = [x for x in range(-10,10) if x!=0]
speeds = {}
while 1:
i = ball.stamp() # 返回图章编号
dx = choice(velocity) # 水平速度
dy = choice(velocity) # 垂直速度
speeds[i] = (dx/20,dy/20)
以下代码省略......
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)
