Answer the question
In order to leave comments, you need to log in
How to make character control with mouse and keyboard?
Fight everyone
I'm making a two-dimensional game, a top view, I made character control scripts through the keyboard
I also want to add mouse control (as in the alien shooter for example). I found an article on how to do this, but I can’t figure out how to build such a control into my 2d game
, if anyone has come across, tell me plz. Or throw links with similar tutorials, I will be very grateful
Answer the question
In order to leave comments, you need to log in
In Alien shooter, only the rotation of the player is set with the mouse. In general terms, you need to calculate the coordinates of the cursor relative to the center of the screen. Next, calculate the rotation and radius (see polar coordinate system). Well, actually, speed = radius, direction = angle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question