![]() |
Absolute Positions |
Helper functions for pixel movement worlds. [More] |
To download this library for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Kaiochao.absolutepositions##version=2 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Kaiochao.absolutepositions##version=2 |
This library includes:
Example proc/move_towards(atom/movable/a, atom/b, speed) |
Reformist: (Sep 29 2015, 4:53 pm)
When using it to move one object towards another, re-calculating the angle to see if the object being moved to has moved as well, it performs strangely. In certain quadrants it will simply move away from the object instead of towards. In quadrants where it moves towards the object it ends up performing a parabola, moving really close to the object then bending away. Switching sin() and cos() corrects this issue.
Kaiochao: (Sep 29 2015, 1:55 am)
They are correct as-is. My BYOND projects (and thus my Project()) have always used the convention that angles increase clockwise from up. I always draw my rotatable artwork pointing up, and positive rotations effectively turn to the right when using matrix.Turn() and icon.Turn().
Reformist: (Sep 29 2015, 1:00 am)
The sin and cos in the Translate() return in Project() need to be flipped.
currently: return Translate(Distance * sin(Angle), Distance * cos(Angle), Dir) should be: return Translate(Distance * cos(Angle), Distance * sin(Angle), Dir) FKI: (Aug 20 2015, 8:48 pm)
Yeah, it was something I did somewhere, no idea what though. Github is a lifesaver however.
Again, appreciate the help (and your work as well). |
Copyright © 2025 BYOND Software.
All rights reserved.
2. Your angle isn't "clockwise from up", which is the more common navigational standard; it's probably "counter-clockwise from right", which is the more common math standard. Here's my atan2() that works in my convention: