ID:140486
 
Code:
client/West()

src.mob.dir = WEST
for(var/i=4,i,i--)
sleep(1)
if(!mob.CollisionDetect())
src.mob.pressing = 1
src.mob.px -= mob.pps/4
src.mob.pixel_x -= mob.pps/4
src.pixel_x -= mob.pps/4

if(src.mob.pixel_x == -32)
src.mob.x--
src.mob.pixel_x = 0
src.pixel_x = 0

spawn(1)
src.mob.pressing = 0
atom/movable/proc/CollisionDetect()
switch(src.dir)
if(EAST)
for(var/atom/O in oview(1))

if(O.density ==1&&src.y==O.y)
if(O.px <= src.px+src.pps)
world<<"Too close"
return 1
if(WEST)
for(var/atom/O in oview(1))
if(O.density ==1&&src.y==O.y)
if(O.px >= src.px-src.pps)
world<<"Too close"
return 1



Problem description:
It stops you from moving in any direction if it's too close.

Footnote: The for loop in the West proc is so that it moves more fluently
If you rename CollisionDetect to IsCollisionDetected and update it so it returns an obvious result, you will most likely discover the problem.

ts
You're doing it wrong.

First of all, you should have one two args, one for pixel_x gain, and another for pixel_y gain. That way, you don't end up with tons of if()'s. Then, you use a standard collision algorithm - read this.