Guest User

Untitled

a guest
Aug 20th, 2018
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //arah antara dua titik
  2.  
  3. x1 = node[n-1].x;
  4. y1 = node[n-1].y;
  5. x2 = node[n].x;
  6. y2 = node[n].y;
  7.  
  8. jarakX = x2-x1;
  9. jarakY = y2-y1;
  10.  
  11.  
  12. //ini maksudnya y/x tapi dari radiannya, fungsi ini otomatis kalau di flash mah
  13. derajat =   Math.atan2(jarakY, jarakX);
  14.  
  15. //ketemu deh derajatnya, bisa buat thrust
  16. kecepatanX = Math.cos(derajat)*kecepatan;
  17. kecepatanY = Math.sin(derajat)*kecepatan;
Add Comment
Please, Sign In to add comment