How would I go about preventing the player's sprite from changing its .dir var whenever I have the player move via movement verbs that call the step() or move() procs?
Won't that just have force_dir be the default value for Move() to call if none is provided?
|
Yes. The way Move() works when it comes to directions, is basically this:
If Dir: set dir to Dir Else: set dir to get_dir(src,NewLoc) By adding Dir=force_dir in the arguments, we're effectively changing that logic to: If Dir: set dir to Dir Else if force_dir: set dir to force_dir Else: set dir to get_dir(src,NewLoc) |
Yep, you are correct. I actually use my own Step() variants defined under atom/movable, rather than the global procs. Mine don't actually provide the direction of the movement by default. Original post has been amended to reflect the globals.
|
And just to be sure, does step() change the direction, or is it Move() that does it, normally?
|
Now just set force_dir to a valid direction. When you no longer want the direction the player faces to be forced, set force_dir back to 0.