mob
proc/KnockBack(mob/M,direction,times2move as num)
spawn() //so we don't stop w/e is happening where this proc was called
for(times2move,times2move>0,times2move--)
if(!M)return
step(M,direction)
frozen = 1
flick("Pushed",src)
var/obj/a = new/obj/dirts
var/obj/b = new/obj/dirts
var/obj/c = new/obj/dirts
var/obj/d = new/obj/dirts
a.loc = M.loc
b.loc = M.loc
c.loc = M.loc
sleep(1)
frozen = 0
The code above(it is all put together in a weird way here but it is alot more cleaner in the code) makes the enemy get pushed back when they are hit, causing a dirt obj to appear under their feet for a short period of time until disapearing. Everything works very smoothly except for the fact that after the enemy stops being knocked back they are facing the direction that they had walked in, instead of facing the same direction as the knockback. Any ideas? anything will help! thank you!
NewLoc (required): The location to move to.
Dir (optional): The direction the object should face.
step_x & step_y (optional): (used for "pixel movement".)
In order to get the newloc argument, just call get_step(object_to_be_moved, direction_of_movement).