It seems you already solved this, but I figured I could try to provide some info in the case it breaks, or potentially another way to do it.
Anyhow, your cell/grid approach sounds to me like what most RPGS would use (generally with the 3/4 view). In such games, your character can face four directions, where you face in the direction you moved last. If this IS the case, skip to the next paragraph. Otherwise, if you are making some sort of smooth rotation (i.e instead of a solid facing, the character/token/whatever_moves smoothly turns ver several render frames), then what you can ideally do is, find the difference between the DESIRED angle (should be one of four for the cardinal directions) in terms of what you would need to incriment to go closer to said angle, and incriment a small portion of it. I still don't get how the formula works, but I beleive:
return ((((argument0 - argument1) mod 360) + 540) mod 360) - 180;
- will find the difference needed in terms of your current direction (arg0) to the desired (arg1). I have never done such smooth turning myself, though, so sorry if that is incorrect.
On the other hand, if you simply want to face the direction you move in, this is actually quite simple. My first recomendation would be to, if you don't already have something of this sort, have a function like move(direction), if your language supports enums, a direction enum would be useful here. (is this C#?) Inside that, you do a case statement (easy with only four cases). For reference, angles generally have RIGHT = 0, UP = 90, LEFT = 180, DOWN = 270 -hence, 360 = 0; Thus, you can, when moving said direction, rotate your (sprite?) character by the constant angle defined by that direction (as in, an absolute setting: calculating relative is a bit more tricky, but still pretty simple). Here is how I picture it:
void move(Direction direction)
{
switch (direction)
{
case RIGHT:
(set rotation/direction of character/sprite to 0)
(other stuffs, like updating grid array to movement)
break;
case DOWN:
(same as above but now it is 270)
break;
...
}
}
//UP = 90, LEFT = 180
Note that in general, 0 degrees is right, and it goes 360 degrees COUNTERclockwise. However, these may depend on what you are using (I know an external library which seems to rotate clockwise, which in theory is more natural but conflicts with the more general view, so you will have to figure this out yourself). Also, in the case you just want a different sprite for each facing direction, then you can simply set the sprite by case, for example, in RIGHT case you can do sprite = RIGHT_SPRITE, etcetra.
Hopefully this will be useful, sorry if it isn't.