Pixel Movement

by Kaiochao
Helpers for pixel movement.
ID:2130186
 
Helpers for pixel movement:
atom/movable
proc
PixelMove(move_x, move_y)
PixelMove(vector2/move)

PixelSlide(move_x, move_y)
PixelSlide(vector2/move)

PixelMoveTo(center_x, center_y)
PixelMoveTo(vector2/center)
PixelMoveTo(atom/center)

PixelSlideTo(center_x, center_y)
PixelSlideTo(vector2/center)
PixelSlideTo(atom/center)

SetLowerTo(lower_x, lower_y, z)
SetLowerTo(vector2/lower, z)
SetLowerTo(atom/lower)

SetCenterTo(center_x, center_y, z)
SetCenterTo(vector2/center, z)
SetCenterTo(atom/center)


7/27/2019
Added PixelSlideTo.
Updated documentation.
I've added the library to my game, but how do I make this work?
In response to Phennexion
This is a library containing some functions that make the native pixel movement in BYOND easier to work with. Along with the Pixel Positions library to get world pixel positions of atoms, you can use this library to set world pixel positions of atoms and move them around by pixels.

There should be a decent explanation of everything inside the code file.
I also don't understand how to enable this library. Read through this vector2 & pixel positions.

I'll give it another read, it looks solid I'm just waking up and realizing it's not just plugin and play aha.
In response to Flame Guardian
I'm not sure what you're expecting from including this. It doesn't change any built-in systems, it's not a movement system overhaul.

It's simply a set of tools to work with built-in pixel movement easier. Tools don't do anything by themselves.

Like in any other game engine, you need to combine this with a player input system and a game loop to actually move the player over time according to their inputs.
I got this working. Actually super helpful.

How would I go about slowing someone down when using something like PixelSlideTo()? I did a few attempts, but it just ends up being something teleporting to something else every few seconds/middleseconds rather then being a smooth transition.


No tabbing but here is some code I was playing around with.
for(var/mob/player/p in oview(9,src))
if(p)
PixelSlideTo(p)


Move()
if(!just_moved)
just_moved=1
spawn()
sleep(move_speed)
just_moved=0
..()
I guess walk_to() would just be better in that case.