ID:261617
 
Ok, the jump command works FAIRLY correct now. i'm having one problem:
when I jump to the left, every thing works fine. but when I land, instead of my icon having mario face left, it faces right.
so basically when i jump left, when he lands he turns to the right.

mob
proc
jump() // jump, used for projecting yourself into the air, for your own reasons.
if(src.jumping == 1) // You can't jump if you're already jumping.
return
var/turf/aturf = locate(src.x, src.y-1, src.z) // Get the turf directly below you.
var/dense = 0
if(aturf)
for(var/atom/A in aturf)
if(A.density == 1)
dense = 1
break
if(aturf.density == 1)
dense = 1
// Those few lines above are used to make sure you're on something dense. You can't jump if you're falling.
if(!aturf)
dense = 1
if(dense == 1) // If they're on something...
src.jumping = 1
for(var/I = 0, I < (gravity * 1.5), I++) // This is a traditional for loop that loops until I(init 0) is equal to gravity times 1.5.
spawn()
if(src.loc != null)
if(usr.dir==EAST)
usr.icon_state="smario jump right"
step(src, NORTH)
usr.dir=EAST
if(usr.dir==WEST)
usr.icon_state="smario jump left"
step(src, NORTH)
usr.dir=WEST
sleep(gravity)
if(src.jumping == 0)
break
src.jumping = 0
spawn(gravity) src.GravCheck() // Spawn GravCheck again, since it probably discontinued it's loop while you were airborne.


GravCheck() // Your artificial gravity.
if(src.jumping == 0) // If they're in the process of going up, don't do the gravity thing.
if(fall_type == 1)
var/dense = 0
var/turf/spot = locate(src.x, src.y-1, src.z)
if(spot)
for(var/atom/A in spot)
if(A.density == 1)
dense = 1
if(dense == 0 && spot.density == 0)
src.Move(locate(src.x, src.y-1, src.z))
else usr.icon_state = "smario"

BTW: when i jump, and try to jump again i cant.
look at cinnom's side scrolling demo