ID:170460
 
In the following code how can I make the players "walk" to the place instead of teleporting? (This is for a sidescroller game)
client
North()
if(mob.inair) return
if(mob.speed)
if(mob.dir == EAST)
mob.Move(locate(mob.x+mob.speed, mob.y+5, mob.z))
mob.inair = 1
mob.Gravity()
else if(mob.dir == WEST)
mob.Move(locate(mob.x-mob.speed, mob.y+5, mob.z))
mob.inair = 1
mob.Gravity()
else
mob.Move(locate(mob.x, mob.y+5, mob.z))
mob.inair = 1
mob.Gravity()
There are many ways of doing this. I was going to post a snippet, but instead I decided to show you one.

-One of the ways is to walk the mob in the direction for a chosen duration. This requires three things which are:
Define a duration variable
Drop your speed variable
Change it into a delay variable
*- walk(mob,EAST,delay) followed by sleep(duration) and finally walk(mob,0)


<font size =-4>COMMENT: Your duration and your delay variables need to be correlated in a way that will allow seemless lagless walking. Having them out of balance can result in choppy faultered walking.</font>
In response to ManDroid13
Oh yeah umm this is for jumping in a sidescroller game..All the speed variables does (for now) is determine how far you jump..
In response to Dession
Duration replaces speed in this example. =/