Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # shape as type, size, orbitradius, startx, starty
- solsystem = np.array([
- ['sun', 2, 0, (screenx // 2), (screeny // 2)],
- ['planet', 1, 200, 200, 200]
- ])
- class makebody():
- def new(btype, size, orbitradius, x, y):
- nbody = body()
- nbody.type = btype
- nbody.size = size
- nbody.orbitradius = orbitradius
- nbody.x = x
- nbody.y = y
- nbody.color = (0, 0, 255) #blue
- if (btype == 'sun'):
- nbody.color = (255, 255, 0) #yellow
- return nbody
- bvec = np.vectorize(makebody.new)
- body = bvec(solsystem)
- for t, size, orbitradius, x, y in np.ndindex(solsystem.shape):
- body = makebody.new(t, size, orbitradius, x, y)
Add Comment
Please, Sign In to add comment