import massspring as m m1 = m.mass(m=20, r=45, x=-50, y=5, z=0, vx=20, vy=0, vz=0, moveable=True, solid=True, bound=True, color=m.colors.RED, visible=True) m2 = m.mass(m=30, r=60, x=50, y=0, z=5, vx=-20, vy=0, vz=0, moveable=True, solid=True, bound=True, color=m.colors.GREEN, visible=True) m.mainloop(100, 0)
moveable=False, solid=True, bound=True, resistible=True, color=m.colors.RED, visible=True) for i in range(NM): m.mass(m=10, r=5, x=i * d + d, y=200, z=i * d, vx=0, vy=0, vz=0, moveable=True, solid=True, resistible=True, bound=True, color=m.colors.RED, visible=True) m.spring(k=1000, nl=0, m1=m.mass_lis[i + 1], m2=m.mass_lis[i], color=m.colors.WHITE, visible=True) m.mainloop(10)
""" import massspring as ms n = int(input("how many cockroaches? ")) assert n % 2 == 0, ValueError("n must be dividable by 2 but it's value is %d" % n) r = 20 m = 10 d = 56 _vx = 30 for i in range(-n // 2, n // 2): x = i * d + d // 2 vx = -ms.sign(x) * _vx ms.mass(x=x, m=m, r=r, vx=vx, bound=False) s = 0 def frame(): global s for c in ms.collision_lis: if c.check_collision(): s += 1 ms.mainloop(2, 0, frame=frame) print(s)