Make one actor face another: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
LordMisfit (talk | contribs)
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
In this example code, the actor will find the closest PIGCOP actor within 2048 units and face towards it.
In this example code, the [[actor]] will find the closest PIGCOP actor within 2048 units and face towards it.  This code does not contain the [[gamevar]] definitions, which must be placed outside of the actor code.


<pre>
<pre>
Line 15: Line 15:
}
}
</pre>
</pre>
[[Category: Tutorials]]

Latest revision as of 11:12, 24 September 2006

In this example code, the actor will find the closest PIGCOP actor within 2048 units and face towards it. This code does not contain the gamevar definitions, which must be placed outside of the actor code.

findnearactor PIGCOP 2048 TEMP
ifvarn TEMP -1
{
        getactor[TEMP].x MX
        getactor[TEMP].y MY
        getactor[THISACTOR].x x
        getactor[THISACTOR].y y
        subvarvar MX x
        subvarvar MY y
        getangle ANGVAR MX MY
        setactor[THISACTOR].ang ANGVAR
}