Gap-Nudge Movement

by Woo
Pixel movement that navigates through gaps and around corners. Also combines cardinal key presses into diagonal movement. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Woo.GapNudgeMovement##version=10

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:


Version 3.3
Date added: Jul 17 2017
Last updated: Feb 28 2018
3 fans
Gap-Nudge Movement
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.

Version Notes:
  • 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.
If you have any feature suggestions, please leave a comment in this library's discussion forum.

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!

Visit to check out my other work in game design!

Tyruswoo Official Site

Join the Tyruswoo BYOND community!
Tyruswoo BYOND YouTube Tyruswoo BYOND Patreon
Tyruswoo BYOND Site Tyruswoo BYOND Discord Chat
Only you can build your dreams.