OZONE Asylum
Forums
DHTML/Javascript
Need some help aiming an enemy sprite
This page's ID:
30701
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
x and y of course being the distances between player and enemy. [i]"The atan2() method returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians."[/i] So you have the direction your enemy should turn to. But you also have the current orientation of your enemy. I didn't understand why you have to check for every possible value. just do this: if (direction < orientation + 0.05 && direction > orientation - 0.05) { shootOrWhatever(); }
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »