Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to_direction(start_x, start_y, target_x, target_y)
- radians = Math.atan2(target_x - start_x, target_y - start_y)
- end
- # cima (8)
- p to_direction(2, 1, 2, 0)
- # baixo (2)
- p to_direction(2, 1, 2, 3)
- # esquerda (4)
- p to_direction(2, 1, 0, 1)
- # direita (6)
- p to_direction(2, 1, 3, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement