N
N
nano_e_t_42017-08-24 14:54:55
Game development
nano_e_t_4, 2017-08-24 14:54:55

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

1 answer(s)
G
Griboks, 2017-08-24
@nano_e_t_4

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 question

Ask a Question

731 491 924 answers to any question