tommysticks Posted July 13, 2015 Share Posted July 13, 2015 Anyone have any suggestions to detect the distance between the player and the nearest zombie? I'm still lookin through existing lua files and methods but figured I'd check here too. Link to comment Share on other sites More sharing options...
RoboMat Posted July 13, 2015 Share Posted July 13, 2015 I'm sure there is some function to calculate it hidden somewhere, but something like this should work:local dx, dy = playerX - zombieX, playerY - zombieY;local distance = math.sqrt(dx * dx + dy * dy);Basically some simple vector math + pythagoras. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now