A BYOND library
By Tyruswoo "Woo"
Enhances pixel movement by allowing the player's mob to detect nearby gaps in the direction the player is trying to move, and then nudging the player's mob towards the gap. Never again fear pixel movement through narrow doorways! Collisions with turf, mobs, objects, or any other atom are all handled to allow finding any nearby gap.
Using two cardinal direction keys to move diagonally is also included. For example, if you press the Up and Right keys, you will move diagonally to the northeast.
To test this library out, login and try to move through small gaps in walls or around corners. Your mob will be able to find any nearby gaps through which to move.
- v.2.0: Modified the DensityCount proc to check a smaller bounding box, when appropriate. Now, when attempting to move in a desired direction, even gaps that advance the mob as little as 1 pixel further are found. This makes movement feel more natural when moving around mobs or objs that are offset relative to nearby turfs.
- v.3.0: Added the diagonal_nudge variable. By default this is FALSE, so when moving diagonally into a wall the player will slide quickly (at a speed of mob.step_size) along the wall. Changing diagonal_nudge to TRUE will cause diagonal movement against walls to slide slowly (at a speed of nudge_size, which is 1 pixel); this was the previous default behavior.
Terms: If you use one or more of my libraries in your game, please credit me (as Woo or Tyruswoo) and leave a link back to one of the following: my website, my BYOND site, my YouTube channel, or the webpage of the library you used. Optionally, you could also give me a free subscription to your game, if you like!
Join the Tyruswoo BYOND community!