ID:1578463
 
(See the best response by Ter13.)
Code:
        Enter(mob/player/m)
if(m.dir == SOUTH)
m.pixel_y = -5
sleep(1)
m.pixel_y = -10
sleep(1)
m.pixel_y = -15
sleep(1)
m.loc=locate(src.x,src.y-1,src.z)
m.pixel_y=0


Problem description:

Is there a better way to make jump effect?

Best response
Many better, as a matter of fact.

The real question is what you want a jump to actually do.

A real fast example would be to set up a special density flag for objects that can be jumped over.

atom
var
jump_density = 0
movable
Cross(atom/movable/o)
. = ..(o)
if(!. && ismob(o))
var/mob/m = o
if(m.jumping && !src.jump_density)
return 1
mob
var
jumping = 0

turf
Enter(var/atom/movable/o)
. = ..(o)
if(. && ismob(o))
var/mob/m = o
if(m.jumping && !src.jump_density)
return 1


That should allow you to jump over anything that isn't specifically meant to block a jump action. Now jumping is as simple as:

mob
proc
Jump(Dir,Dist=1,Delay=TICK_LAG)
var/opz = src.pixel_z
//make the player appear to rise and fall during the jump
animate(src,pixel_z=opz + 64,time=Delay*Dist/2)
animate(pixel_z = opz,time=Delay*Dist/2)
//loop to move across the distance
for(var/count=0;count<Dist;count++)
. = step(src,Dir)
if(!.)
//if the movement fails, make the player fall quickly.
animate(src,pixel_z=opz,time=Delay)
break
sleep(Delay)
It seems something is wrong with it


m: compile failed (possible infinite cross-reference loop)
m.jumping: compile failed (possible infinite cross-reference loop)

turf
Enter(var/atom/movable/o)
. = ..(o)
if(. && ismob(o))
var/mob/m = m
if(m.jumping && !src.jump_density)
return 1


Minor typo corrected.