Sprite rotation help

Sorry I took awhile to respond, here’s how it works:

  1. I used the browser extension to get the mouses location, but then I had to do a little math to make it relative to camera. I placed a sprite on that position every frame as a cursor.
  2. I have another sprite for the gun, which is set to the players location every frame. I placed the gun art to the far right of the Sprite so that when it rotated it swiveled around the character.
  3. Then, I used a block in the Sprite Util extension to find the angle between the player and the cursor, and set that to the guns rotation.
  4. When it fired, I got the same angle and made a sprite to move in that angle using a different block in Sprite Util.

Hope this was helpful! If you want, you can look at the code in this, it should be less laggy.

6 Likes