ID:140066
 
Code:
mob
animate_movement=NO_STEPS
var
YD // Y distance traveled
XD // X distance traveled
PXD // pixel_x distance traveled
PYD // pixel_y distance traveled
XD2
YD2
PXD2
PYD2
XD3
YD3
PXD3
PYD3
speed=4
moving=1
colides=0
verb
NORTH(mob/M)
M.dir=NORTH
if(M.moving==1)
M.moving=0
M.PixelMove(0,1,0,M.speed,M)
SOUTH(mob/M)
M.dir=SOUTH
if(M.moving==1)
M.moving=0
M.PixelMove(0,-1,0,-(M.speed),M)
EAST(mob/M)
M.dir=EAST
if(M.moving==1)
M.moving=0
M.PixelMove(1,0,M.speed,0,M)
WEST(mob/M)
M.dir=WEST
if(M.moving==1)
M.moving=0
M.PixelMove(-1,0,-(M.speed),0,M)
NORTHSTOP(mob/M) // I set these verbs as my key release. But they are delaying based on how long I hold the key down. IT is annoying.
M.moving=1//turns off movement
M.speed=4
M.icon_state="stop"
SOUTHSTOP(mob/M)
M.moving=1//turns off movement
M.speed=4
M.icon_state="stop"
EASTSTOP(mob/M)
M.moving=1//turns off movement
M.speed=4
M.icon_state="stop"
WESTSTOP(mob/M)
M.moving=1//turns off movement
M.speed=4
M.icon_state="stop"
proc
PixelMove(XD,YD,PXD,PYD,mob/M) // proc: pixel distance moved.
if(M.moving!=1)
M.icon_state="motion"
M.x+=XD
M.y+=YD
M.CheckCollision(XD,YD,PXD,PYD,M) //checks to see if mob collides with object
if(M.colides==0)//when colides = 0 the mob will move.
M.x-=XD
M.y-=YD
M.pixel_x+=PXD
M.pixel_y+=PYD
M.CheckMovement(XD,YD,PXD,PYD,M) //checks to see when to move up one.
else
colides=0
CheckCollision(XD2,YD2,PXD2,PYD2,mob/M,obj/O)
for(O in M.loc)
if(M.Enter(O))
M.x-=XD2
M.y-=YD2
M.colides=1
CheckMovement(XD3,YD3,PXD3,PYD3,mob/M)
if(M.pixel_y>=16)
M.y+=YD3
M.pixel_y-=16
M.pixel_y+=PYD3
if(M.pixel_y<=-16)
M.y+=YD3
M.pixel_y+=16
M.pixel_y+=PYD3
if(M.pixel_x>=16)
M.x+=XD3
M.pixel_x-=16
M.pixel_x+=PXD3
if(M.pixel_x<=-16)
M.x+=XD3
M.pixel_x+=16
M.pixel_x+=PXD3


Problem description:

OK, yes I know that it is a long code snippet. Anyways. I am working on trying to get a pixelbased movement system set up using mob/M instead of atoms, I had already looked at several tutorials. I am not asking for help, as this entire code works. The issue is, and it is bugging me so much, Why is my key release setup on here not realizing that it is suppose to stop. I messed with the code trying to figure it out, but to be totally honest, I dont think its the code. Anyways if your looking for a slide effect copy this code lol. JK, please help.
Do you have macros for the key-down events set to REPEAT?
You should try taking a look at Macro Move to figure out how to handle fluid movement.
In response to Garthor
Yes, but I also tried it without the REPEAT, it still does the same thing. lol. Anyways my collision doesnt work real well now that I think about it. I wouldnt worry about this post, I figure that the original way is much better.