仔细看这个粒子效果,粒子之间也有碰撞。

以下是部分代码预览:
"""用物理沙盒制作的粒子效果"""
from pyphysicssandbox import *
from random import randint
class Particle:
def __init__(self):
self.ball = ball((200+randint(-1,1), 350+randint(-1,1)), 2)
self.direction = randint(-500,500),randint(-3000,-2000)
class ColoredParticle(Particle):
def __init__(self,c):
super().__init__()
self.color = c
self.ball.color = self.color
window("Python物理沙盒粒子效果", 400, 400)
如需要查看完整代码,请:
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)
