Possible Duplicate:
Shoot a bullet towards cursor - top down 2d
I'm creating a 2D top down shooter, and I want to get the bullets to go in the direction of the mouse. Not sure of the logic that goes into it.
I'm creating a 2D top down shooter, and I want to get the bullets to go in the direction of the mouse. Not sure of the logic that goes into it. |
|||||
|
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
You could use trigonometry like here: 2D Magnet-like repelling behavior But the very simplest approach is:
|
|||
|
|