ID:799027
 
Code:
mob/proc
jump()
velocity_y = 20
jumping = TRUE
dir_before_jump = dir

mob/move()
if(jumping)
layer = MOB_LAYER + 10

if(elevation + velocity_y > get_elevation())
if(abs(velocity_y) == velocity_y)
icon_state = "jump ascend"
else
icon_state = "jump descend"
elevation += velocity_y
step_y += velocity_y/2
dir = dir_before_jump
velocity_y -= gravity

else
jumping = FALSE
icon_state = ""
layer = MOB_LAYER
pixel_y = 0
..()


It seems that whenever I jump, when I enter a new tile, the game tries to change my direction to NORTH. The dir_before_jump part was my effort to stop it from doing this, but it still flashes north and is very noticable. Enter() and Entered() are never called when directly modifying step_y; so what do I need to do to stop this?

What are you trying to do? It looks like there's a better way to handle it.

If you're calling mob.Move() somewhere that might be changing your direction.
It's a simple jumping physics system. I am using step() in another place, but nothing happens if you send 0 to step() (And since I am only hitting space, which is my macro for calling jump(), nothing is being sent to step()). The code above is pretty much the only relevant code, other than the code that calls move(), which was used from your demo in your keyboard library:
client

key_down()
key_repeat()

New()
..()

// start the movement loop
spawn()
movement_loop()

proc
movement_loop()
// call the move() proc once per tick
while(1)
move()
sleep(world.tick_lag)

move()
if(!mob.can_move)
return

// figure out what direction the client's mob should
// move in based on what keys they're holding.
var/d = 0

if(keys["north"]) d |= NORTH
if(keys["south"]) d |= SOUTH
if(keys["east"]) d |= EAST
if(keys["west"]) d |= WEST

// move them in that direction
mob.move(d)
Wow, I just decided to add a check for giggles and it worked. So passing 0 to the dir argument of step() apparently defaults to NORTH. It works fine now.
    move(d = 0)
if(d)
step(src, d)
tututut Getting help for codes for ma game. BAD ALBRO! :D