examples/chipmunk_and_rmagick.rb
def check_off_screen
    pos = @body.p
    if pos.y > HEIGHT + EDGE_SIZE or pos.x > WIDTH + EDGE_SIZE or pos.x < -EDGE_SIZE
      @body.p = CP::Vec2.new(rand * WIDTH, 0)
    end
  end
# If it goes offscreen we put it back to the top.
If it goes offscreen we put it back to the top.
If it goes offscreen we put it back to the top .
def check_off_screen
    pos = @body.p
    if pos.y > HEIGHT + EDGE_SIZE or pos.x > WIDTH + EDGE_SIZE or pos.x < -EDGE_SIZE
      @body.p = CP::Vec2.new(rand * WIDTH, 0)
    end
  end
def check_off_screen pos = @body . p if pos . y > HEIGHT + EDGE_SIZE or pos . x > WIDTH + EDGE_SIZE or pos . x < - EDGE_SIZE @body . p = CP :: Vec2 . new ( rand * WIDTH , 0 ) end end
If it goes offscreen we put it back to the top.
If it goes offscreen we put it back to the top .