Skip to content
← Back to Community
Rotation help
Profile icon
[deleted]

So I'm making a multiplayer shooting game in javascript. I want to make the gun point torwards the mouse pointer. The gun is the little red rectangle that is below the player. I can't get it to rotate torward the mouse pointer. The code starts at /client/client.js line 103.
Can you explain how to make it point to the mouse pointer?

https://repl.it/@Helixable/FireAway

Voters
Profile icon
NicolasAngiulli
Profile icon
UMERASIF1
Profile icon
SamuelWaller
Comments
hotnewtop
Profile icon
[deleted]

Your code is a bit much to understand so I have made a mock up that shows how to rotate a "gun": https://rotating-gun--malvoliothegood.repl.co