Getangle: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Plugwash (talk | contribs)
No edit summary
Fox (talk | contribs)
No edit summary
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
getangle <x> <y>
'''getangle''' <return> <x> <y>


Get's the angle formed by the displacements <x> and <y>. In most languages this function is known as arctan2.  
Returns the angle formed by the displacements <x> and <y>.


NOTE: To make one actor face another some subtraction is involved. see [[make one actor face another]] in the examples.
In most languages this function is known as arctan2.
 
== Examples ==
 
To make one actor face another some subtraction is involved.
 
set X sprite[OTHER_SPRITE].x
set Y sprite[OTHER_SPRITE].y
sub X sprite[].x
sub Y sprite[].y
getangle ANG X Y
 
[[Category:EDuke32 specific commands]]
[[Category:Gamevar manipulation]]

Latest revision as of 01:36, 20 February 2020

getangle <return> <x> <y>

Returns the angle formed by the displacements <x> and <y>.

In most languages this function is known as arctan2.

Examples

To make one actor face another some subtraction is involved.

set X sprite[OTHER_SPRITE].x
set Y sprite[OTHER_SPRITE].y
sub X sprite[].x
sub Y sprite[].y
getangle ANG X Y