Hey, guys! Remember that RPG i said i was working on? Well, i am glad to say that the basics are 99% finished. Now everything i need to do is design some quests, and change some script variables everytime i want to make something actually work, and in a few weeks maybe my RPG will be just fine!
Sort of… You probably noticed the 99%. Well, that’s because i am facing a little problem with triggering diagonal movement. You see, i am good with about anything, EXCEPT scripting characters. I have a single walking animation for my character, so i am using a really simple trick to make it’s body rotate everytime the player presses W,A,S, or D. The problem here is that i can rarely make the body rotate diagonally by pressing a combination (Ex: W+D → Diagonal Right) because i would need to press both keys at the same time. Also, what i am using is pretty stupid. As i said, i am NOT good at scripting characters, so i am kinda stuck here. Any hint?
The code looks fine.
I´m by no means a professional Coder myself, but I would say, when the code is easily understood and works it´s fine.
Why don´t you check for additional Keypresses?
e.g. when you already recorded the KeyDown-Event in Direction “W”, you check for KeyDownEvents for “A” and “D”, and then alter the direction acordingly?
It would be alot easier, if you could use Input.GetKey instead of Input.GetKeyDown.
Maybe check if the rotation of the body is already correct, before overriding it, if that was your reason for using GetKeyDown in the first place.