Help with character controller

Hello,
I need a character and camera controller for the game I’m developing. However, no matter what I do, I can’t get the result I’m looking for.
I’ve been dealing with this for a very long time because thinking about opening a topic was my last resort, believe me.

First of all, let me state my purpose and the result I aim for: I am trying to make a character and camera controller for my game, which I developed in Unity game engine, like Metin2 or Inferna Online game.
Features: Classic as in Metin2 or Inferna Online game, character control with (Key Code: WASD), physical attack of the character with (Key code: SPACE), (reaching the destination you clicked with the left mouse button (attackable target or location)) , camera controls with right mouse button (up-down right-left 360° rotation)

Detail; Paste2.org - Viewing Paste 7VX09wZY

Now, I have two different controllers that I have prepared, one of these controllers goes where you click, but it causes an abnormal problem in the character’s movement system. I was going to try to show this with a video, but I can’t because the server is down right now.
Another is close to my aim but does not attack the place or target you clicked on. To put it briefly, my goal is to create a motion and camera controller like a Metin2 game on a single controller.

  1. Controller; Paste2.org - Viewing Paste NX0hUE4e
  2. Controller; Paste2.org - Viewing Paste xkzdVB0z

I ask for your help.

Steps to success:

  • list the requirements of your controller in unambiguous terms

  • step through the list of requirements, and for each feature:
    —> implement each function
    —> test it thoroughly, AND test all previously-accomplished functions
    —> when one works, commit it to your source control
    —> move onto the next feature.
    —> if you have difficulty, back up to a previous version and retry.

When I say “unambiguous terms” I do NOT mean “Character control with keys WASD”

How about:

W makes the player move east on the screen

OR

W makes the player turn to face left

OR

W makes the player move relative left to whichever way the camera faces

etc.

Sorry, I didn’t want it to appear here as a vague term.
I mentioned that the character can move forward and backward with the W, A, S, D keys.
Since a detailed video explaining these clearly is already in the content, I did not feel the need to explain it in writing. I thought it would be easier for people to see.

Kurt-Dekker wasn’t asking you to explain it to us in unambiguous terms. He meant that as an exercise for you to begin. The first step in programming is always to figure out exactly what the program needs to do. Once you do that, writing the code is the easy part. A lot of people struggle to code something because the haven’t actually sat down and broke-down their problem in to the basic elements.

Since you have two mostly-working controllers though, why not fix one of them? for example:

Why not just add the code to attack?

2 Likes

Did you use scripts/examples you found elsewhere online?

If you did, it’s going to take trial, error, testing, and a lot of deep thought to get them to work exactly how you want them. I would take the script that is closest to how you want it, list out all the stuff that doesn’t work like how you want, find those sections/portions in the scripts, and tackle them one at a time.