by Kidpaddle45
Create a compass on-screen and have it point in a direction based on your target's position on map.

Requires BYOND V.500+

Can be used freely, no credits required. (Knowing where it's used would be cool!)

Just like in MMORPGs:

Run game and double click the box to start the compass!
+1. Cool use of the new features.
pretty jumpy when taking single steps around the target, otherwise it looks great when walking consistently towards/around something.
It would be cool if you could do that bounce ease thing so if you change directions like that it mimics how a compass has to "settle down".
In response to Jittai
You could, but that isn't ideal for in-game navi.
In response to NNAAAAHH
pretty jumpy when taking single steps around the target, otherwise it looks great when walking consistently towards/around something.

I'm pretty sure this is caused from a BYOND bug. It was reported.
I get errors : matrix: undefined proc animate: undefined proc
In response to Phat T
Upgrade to BYOND v500.
I upgrade byond to v500 and it works with out errors. But the arrow wont move it will just stay and point on Eeast
You need to double click on the target (The little present box)
This is awesome! Good job.
In `get_angle_nums(...)` function, your line `while(deg > 360) deg -= 360` should be able to just be replaced with `deg %= 360` which will be a bit more efficient. Maybe not noticeably, but I don't see a reason not to change it and I'd expect if you're running this with a lot of people it might make a difference.

You can then also remove the line, `while(deg < 0) deg += 360`.

This is very cool, though. I had done something long ago in a game but had to generate all the icons ahead of time. Nice to see it done with this new BYOND functionality.
In response to Airjoe
That would be better replaced with a floating point modulo. I can't see the code now, but I can't imagine this system would even need to keep the angle in any bounds.
Sorry Kaiochao, I don't understand what you're saying. Can you rephrase or elaborate?
In response to Airjoe
The % operator is a modulus that rounds at some point (either the input numbers or the output, I'm not sure). A floating point modulus keeps numbers as floats, i.e. containing decimals.

tl; dr: Angles are real numbers, not just integers. The % operator only supports integers.
Ok, I got you, thanks. I wasn't sure what you meant with regards to "need to keep the angle in any bounds".

OP's code is already rounding to the nearest 1, so my proposed change doesn't affect the end result.

Does BYOND's `turn` procedure accept floats for an angle?
In response to Airjoe
Neither BYOND's turn() nor icon.Turn() are used in this example, although I'm not sure if they round their angles.

I remember Lummox claiming that matrix rotation (which is used in this example), unlike icon.Turn(), does support floats. They don't need to be in [0, 360), either.
I'm not so familiar with all this new stuff, but how is BYOND's built-in `turn` procedure not used in the call to `animate`? Or are you just being nitpicky and acting as if "BYOND's `turn`" only refers to `turn(Dir, Angle)` and not also to `turn(Matrix, Angle)`? I thought it was pretty clear what I was asking.
In response to Airjoe
I was being nitpicky and referring to turn(Icon, Angle). My mistake.

I forgot turn() is used for matrices too, ever since I started using matrix(Angle, MATRIX_ROTATE).