Guest User

Untitled

a guest
Jan 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # shape as type, size, orbitradius, startx, starty
  2. solsystem = np.array([
  3. ['sun', 2, 0, (screenx // 2), (screeny // 2)],
  4. ['planet', 1, 200, 200, 200]
  5. ])
  6.  
  7. class makebody():
  8. def new(btype, size, orbitradius, x, y):
  9. nbody = body()
  10. nbody.type = btype
  11. nbody.size = size
  12. nbody.orbitradius = orbitradius
  13. nbody.x = x
  14. nbody.y = y
  15. nbody.color = (0, 0, 255) #blue
  16.  
  17. if (btype == 'sun'):
  18. nbody.color = (255, 255, 0) #yellow
  19.  
  20. return nbody
  21.  
  22. bvec = np.vectorize(makebody.new)
  23. body = bvec(solsystem)
  24.  
  25. for t, size, orbitradius, x, y in np.ndindex(solsystem.shape):
  26. body = makebody.new(t, size, orbitradius, x, y)
Add Comment
Please, Sign In to add comment