shot_noise.py 591 B

123456789101112131415
  1. #!/usr/bin/env python3
  2. import pymunk # Import pymunk..
  3. space = pymunk.Space() # Create a Space which contain the simulation
  4. space.gravity = 0, -1000 # Set its gravity
  5. body = pymunk.Body(1, 1666) # Create a Body with mass and moment
  6. body.position = 50, 100 # Set the position of the body
  7. poly = pymunk.Poly.create_box(body) # Create a box shape and attach to body
  8. space.add(body, poly) # Add both body and shape to the simulation
  9. while True: # Infinite loop simulation
  10. space.step(0.02) # Step the simulation one step forward