Vector Movement

by Zecronious
Upgraded pixel movement, allowing movement like in the real world. Super smooth. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Zecronious.Vector_Movement##version=11

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

byond://Zecronious.Vector_Movement##version=11

260 downloads
Version 5
Date added: Dec 29 2014
Last updated: Aug 23 2015
6 fans
What this primarily does is shift you away from walking some number of steps in a particular direction to applying a force in a particular direction. That force could push the player upwards or to the side or on an angle.

It's super simple to use and is perfect for any game that uses pixel movement.

A demo is included that shows what can be done with it. The specification is here:

/*
Movable Objects (mob,obj)

applyForce(direction, amount)
This is how you move objects, you push them in the direction you want.

gravityOn = 0 or 1
Whether or not you want a constant downward force on your objects.

Change this to off or on respectively.

dragOn = 0 or 1
When you push an object by applying a force this will push back so
that the object doesn't continue moving forever. You might want it
off for floating objects like platforms or spaceships.

Change this to off or on respectively.

maxVerticalSpeed = any positive number
Apply as much force on an object as you like, it won't go faster vertically
than the amount specified by this variable.

Useful for jumping to have a higher vertical max speed.

maxHorizontalSpeed = any positive number
Apply as much force on an object as you like, it won't go faster vertically
than the amount specified by this variable.

drag = any positive number
Alters how much drag there is on an object.
E.g How much they get slowed down by.
Only active if dragOn = 1

gravity = any positive number
Alters how much gravity an object experiences.
E.g How much they get pulled down by by.
Only active if gravityOn = 1

// For experts

apply(X,Y)
How much force you want to apply to an object on the X and Y axis.
apply(0,5) would apply an upward force to the object.
apply(0,-5) would of course apply a downward force to the object.

You don't normally need this but it's helpful if you want custom forces,
not just NORTH, EAST etc
*/