So I've been working on a map for myself where I want to implement a specific movement for battles. I haven't been able to work it out myself yet and perhaps one of you knows how to do it.
Basically, I move on a map with wasd like many others which works and I got that covered. I want to add another type of movement for when you enter a battle (You portal to a special area when you get near an enemy). In that area I want movement to change so that A moves you away from the target if the target is to the right of you, and D moving towards the target. This is while looking at your unit from a regular angle (that would mean A west, D east). However, it won't be linear. Let's say there are 3 targets and you 'focus' one target, you can also move diagonal but still, A/D functionality would remain the same. When you are i.e. east of the target I want A to move towards the target and D to move away from the target.
I hope someone can work it out or get me on track.
So I've been working on a map for myself where I want to implement a specific movement for battles. I haven't been able to work it out myself yet and perhaps one of you knows how to do it.
Basically, I move on a map with wasd like many others which works and I got that covered. I want to add another type of movement for when you enter a battle (You portal to a special area when you get near an enemy). In that area I want movement to change so that A moves you away from the target if the target is to the right of you, and D moving towards the target. This is while looking at your unit from a regular angle (that would mean A west, D east). However, it won't be linear. Let's say there are 3 targets and you 'focus' one target, you can also move diagonal but still, A/D functionality would remain the same. When you are i.e. east of the target I want A to move towards the target and D to move away from the target.
I hope someone can work it out or get me on track.
Added an image to make it easier to understand.