Pixel Movement

by Kaiochao
Helpers for pixel movement. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Kaiochao.PixelMovement##version=4

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

byond://Kaiochao.PixelMovement##version=4

449 downloads
Version 4
Date added: Aug 10 2016
Last updated: Jul 27 2019
1 fan
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.

Comments

Flame Guardian: (Oct 21 2019, 2:31 pm)
I guess walk_to() would just be better in that case.
Flame Guardian: (Oct 21 2019, 1:28 pm)
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
..()
Kaiochao: (Oct 1 2019, 12:01 pm)
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.
Flame Guardian: (Oct 1 2019, 9:29 am)
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.
Kaiochao: (May 21 2019, 12:39 pm)
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.