Math for aiming animation in 2D game not working

Hi, I am currently making a 2D platformer game, and it will include guns that aim up and down based on the center of the screen, and where the mouse is(similar to terraria), but everything I have tried has not worked correctly.

I have an animation with a duration of 1 second that simply moves the right arm up, 0 Being the arm pointing straight down, and 1 being straight up.

And I have been trying to find the gradient based on the center of the screen(Where the character is), and where the mouse is, but I have been unsuccessful in everything I have tried both myself and solutions online.

it would be better if you actually showed what you did
and i’m confused as to why you’re using gradients

if you want it like terraria, then your arms, gun, and body should be separate images so you could rotate them when your mouse moves (images fixed to the body)

:that’s what I was thinking about ok?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.