control the character with the mouse

the genre is similar, but you also need control along the X axis so that it is possible to move along the Y and X axis in a certain limited field. Because of this, I want to convert key control to mouse control