SHARE
TWEET

Untitled

marlosgama Apr 14th, 2020 388 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def to_direction(start_x, start_y, target_x, target_y)
  2.   radians = Math.atan2(target_x - start_x, target_y - start_y)
  3. end
  4.  
  5. # cima (8)
  6. p to_direction(2, 1, 2, 0)
  7. # baixo (2)
  8. p to_direction(2, 1, 2, 3)
  9. # esquerda (4)
  10. p to_direction(2, 1, 0, 1)
  11. # direita (6)
  12. p to_direction(2, 1, 3, 1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top