How to auto update location?

You need to transform direction.

312597-trans.png

Hello , I have a variable which says the location where character can move.The problem is that if the character rotate 90* the variable don t auto change and it results in an error.
For example : He can to to x location = 100 ; if he rotate, the x location is changing , I need something like a branch i think.Thanks In advance!