Smooth Tile Movement

by Woo
Smooth, beautiful tile-based movement. Perfect for classic RPGs. Includes a variable for an alternate speed when holding Shift. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Woo.SmoothTileMovement##version=6

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

byond://Woo.SmoothTileMovement##version=6

342 downloads
Version 2.1
Date added: Aug 11 2017
Last updated: Feb 28 2018
2 fans
Smooth Tile Movement
A BYOND Library
By Tyruswoo "Woo"

Includes:
smooth_tile_movement.dm
smooth_tile_movement_macros.dms

Smooth, beautiful tile-based movement. Perfect for classic RPGs.

Includes a variable for an alternate speed when holding Shift. See the demo for an example of how to use this shift_step_size variable.

Update Notes:
  • v.1.1: Added toggling the player's speed by holding the Shift key. This can be used for holding Shift to run by setting shift_step_size higher than step_size (as seen in the demo). Or, set shift_step_size lower than step_size to use holding Shift for sneaking. If you don't want shift to do anything, you can set shift_step_size to the same as step_size, or you can remove the Shift macros.
  • v.2.0: Added the move_pattern variable, which can be "fixed", "random", or "custom". This is very useful for defining movement for non-player mobs, or for controlling player mobs during cutscenes. To activate the move pattern, call the atom's MovePattern() proc, as shown in the demo.
    • "fixed" means the mob stands still.
    • "random" makes the mob step 1 tile in a random direction.
    • "custom" makes the mob follow the move route defined by its move_route variable, which a text string containing any number of the characters N, E, S, or W to define the order of the mob's steps. The move_route variable can be defined in the code, or it can be defined individually for each mob placed on the map, as shown for the kids playing tag in the demo.
      • The move_route_skip variable determines whether the mob skips a step in its move route if the step fails (due to something being in the way), and is FALSE by default.
      • The move_route_repeat variable determines whether the mob repeats its custom move route after it is finished, and is TRUE by default.
  • v.2.1: Bug fix: Improved handling of mob collisions when two mobs attempt to enter the same tile at the same moment. This fixes a bug where mobs sometimes got stuck when both trying to enter the same tile. Now, if mobs (or players) begin to enter a tile that appears to not have anything dense inside, but another dense atom enters at the same moment and there is a dense atom there, after all, then the mob (or player) returns to the tile which it was just leaving.
If you have suggestions for improved smooth tile movement, 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 www.tyruswoo.com 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.