Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //arah antara dua titik
- x1 = node[n-1].x;
- y1 = node[n-1].y;
- x2 = node[n].x;
- y2 = node[n].y;
- jarakX = x2-x1;
- jarakY = y2-y1;
- //ini maksudnya y/x tapi dari radiannya, fungsi ini otomatis kalau di flash mah
- derajat = Math.atan2(jarakY, jarakX);
- //ketemu deh derajatnya, bisa buat thrust
- kecepatanX = Math.cos(derajat)*kecepatan;
- kecepatanY = Math.sin(derajat)*kecepatan;
Add Comment
Please, Sign In to add comment