mob
var
Lock = 0
Jumping = 0
High_Jump = 0
Left = 0
Gravity = 2
Old_Dir = "EAST"
proc
Jump()
if(src.Jumping)
return
var/turf/aturf = locate(src.x,src.y-1,src.z)
var/Dense = 0
if(aturf)
for(var/atom/A in aturf)
if(A.density)
Dense = 1
break
if(aturf.density)
Dense = 1
if(!aturf)
Dense = 1
if(Dense)
src.Jumping = 1
if(src.High_Jump)
for(var/I = 0, I < (Gravity * 2.5), I++)
spawn()
if(src.loc != null)
step(src, NORTH)
sleep(Gravity)
if(src.Jumping == 0)
break
src.Jumping = 0
spawn(Gravity) src.Gravity_Check()
else
for(var/I = 0, I < (Gravity * 1.5), I++)
spawn()
if(src.loc != null)
step(src, NORTH)
sleep(Gravity)
if(src.Jumping == 0)
break
src.Jumping = 0
spawn(Gravity) src.Gravity_Check()
Gravity_Check()
if(!src.Jumping)
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)
Dense = 1
if(!Dense && !spot.density)
step(src,SOUTH)
else
if(src.icon_state == "Left")
src.dir = WEST
if(src.icon_state == "Right")
src.dir = EAST
spawn(Gravity) src.Gravity_Check()
client
Northwest()
return
Northeast()
return
Southwest()
return
Southeast()
return
South()
return
North()
usr.Jump()
East()
usr.Old_Dir = "EAST"
if(usr.Lock)
return
usr.Lock = 1
if(usr.icon_state=="Right")
step(usr,EAST)
if(usr.icon_state=="Left")
usr.icon_state = "Right"
usr.dir = EAST
usr.Left = 0
sleep(1)
usr.Lock = 0
return
West()
usr.Old_Dir = "WEST"
if(usr.Lock)
return
usr.Lock = 1
if(usr.icon_state=="Left")
step(usr,WEST)
if(usr.icon_state=="Right")
usr.icon_state = "Left"
usr.dir = WEST
usr.Left = 1
sleep(1)
usr.Lock = 0
return
ID:269413
![]() Jun 21 2005, 1:24 pm
|
|
Along time ago I found a demo on how to do a gravity system. It was very simple.. Later I decided to create my own, adding turning, etc.. Its worked so far, but is there any way I can make it more effiecent? As in use less CPU or cuase less lag?
|