ID:2422765
 
Code:
#define EAST_KEY  "East"
#define WEST_KEY "West"
#define NORTH_KEY "North"
#define SOUTH_KEY "South"
#define RUN "Shift"
#define JUMP "Space"

atom/movable
Width() . = bound_width
Height() . = bound_height
Px(P) . = 1 + bound_x + step_x + (x - 1) * TILE_WIDTH + P * bound_width
Py(P) . = 1 + bound_y + step_y + (y - 1) * TILE_HEIGHT + P * bound_height

var
/* Accumulates the fractional part of movements in the x-axis.
*/

fractional_x

/* Accumulates the fractional part of movements in the y-axis.
*/

fractional_y

proc
Translate(X, Y)
if(!(X || Y)) return
var rx, ry
if(X)
fractional_x += X
rx = round(fractional_x, 1)
fractional_x -= rx
if(Y)
fractional_y += Y
ry = round(fractional_y, 1)
fractional_y -= ry
var s = step_size
step_size = max(abs(rx), abs(ry)) + 1
. = (rx || ry) ? Move(loc, dir, step_x + rx, step_y + ry) : TRUE
step_size = s

client
New(){. = ..();set_macros()}
proc
set_macros()
var/macros = params2list(winget(src, null, "macro"))
var/list/keys = list("0","1","2","3","4","5","6","7","8","9","q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","west","east","north","south","northeast","northwest","southeast","southwest","space","escape","return","center","tab","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","back","shift")
for(var/m in macros)
for(var/k in keys)
winset(src, "[m][k]Down", "parent=[m];name=[k];command=KeyDown+\"[k]\"")
winset(src, "[m][k]Up", "parent=[m];name=[k]+UP;command=KeyUp+\"[k]\"")


mob
key_down(k){..()}
key_up(k,hold){..()}


mob
keydown(k as text)
//if(k == "a") client.North()
..()

keyup(k as text)
..()


movement_loop()
movement = 1
gravity()
if(!knock_i)
if(keys[JUMP])
jumping(19)

forward_x = keys[EAST_KEY] - keys[WEST_KEY]
forward_y = keys[NORTH_KEY] - keys[SOUTH_KEY]


if(movement_check())
#ifndef CAGE_platform_one
roofandfloor()
#endif
//call the gravity() to calculate descent
gravity()
//call the velocity() to calculate the current velocity
velocity()

if(movement_z)
if(movement_z>0)
if(step_z + bound_depth-1 + movement_z > nearestroof()) step_z = nearestroof - bound_depth - 1
else step_z += movement_z
if(movement_z<0)
if(step_z + movement_z < nearestfloor()) step_z = nearestfloor
else step_z += movement_z
if(step_z == nearestfloor)
onfloor()
pixel_y = initial(pixel_y)+step_z

animater()

if(!onfloor) if(shadow)
underlays-= shadow
shadow.loc = locate(x,y,z)
flick("animate",shadow)
shadow.step_x = step_x
shadow.step_y = step_y+nearestfloor
shadow.layer = layer
shadow.invisibility = 0
//var/obj/Effects/Jump/A = new(src.loc)
//A.layer = src.layer+1
else if(shadow)
shadow.invisibility = 102//102

Translate(forward_x * (move_speed + speed_mod), forward_y * (move_speed + speed_mod))
dir = (forward_x ? forward_x > 0 ? EAST : WEST : 0) | (forward_y ? forward_y > 0 ? NORTH : SOUTH : 0)

animater()
movement = 0

movement_check()
. = TRUE

speed_mod = 0
if(keys[RUN]&&keys[EAST_KEY]||keys[RUN]&&keys[WEST_KEY]||keys[RUN]&&keys[SOUTH_KEY]||keys[RUN]&&keys[NORTH_KEY]||In_Battle)
running = TRUE
else running = FALSE;Reset_Icon_State()


if(running)
speed_mod += 2
Reset_Icon_State()


Problem description:

Before the 512 update, our movement in-game was working perfectly fine.....BUT now....the player can't move at all but can still jump. Why is this?

I debugged and found out the translate proc works, but its something to do with the initial definitions. I replaced this code in the movement_loop proc
Translate(forward_x * (move_speed + speed_mod), forward_y * (move_speed + speed_mod))


with....
Translate(1* (move_speed + speed_mod), 1* (move_speed + speed_mod))


and movement worked. So what is the problem here?
It looks like you're using a mixture of Forum_account's Pixel Movement and Keyboard libraries and my Absolute Positions library.

Keyboard is outdated now that we have the Any macro.
Absolute Positions' Translate is outdated now that we have support for non-integers in pixel movement. But if you're using F_a's Pixel Movement, you should be using his own pixel move stuff anyway.

The reason Translate isn't working with forward_x/y is because forward_x/y are 0, because your NORTH/SOUTH/EAST/WEST_KEY definitions are capitalized when they're not capitalized in your keys list. They're not matching up.
I am not using F_a's pixel movement and I realized the forward_x/y are returning as 0 but un-capitalizing them did not make a difference.
I ended up resorting back to this
 if(k == "North") forward_y = 1
if(k == "South") forward_y = -1
if(k == "East") forward_x = 1
if(k == "West") forward_x = -1
</dm.
In response to Anime HQ
It's possible that (in the code that you haven't shown) you're not actually updating the keys list properly so that key[whatever] would actually be 1 when whatever key is being pressed.
Oh well no, when I set it to those codes, the movement works fine. But unfortunately sometimes when i press certain keys simultaneously it stops mid-track. But movement is working now.

I just preferred the other way because movement was being subrtacted from the east and west axis and vice versa for north/south so I was able to press the keys at the same time with n flaws or hiccups.
switch(k)
if("North") {forward_y = 1}
if("South") {forward_y = -1}
if("East") {forward_x = 1}
if("West") {forward_x = -1}