I have a player image which I draw on top of a sword/arm image that I would like to rotate in a swinging motion on click. I figured using sin would be the best approach, however I somehow can’t get that to work very well…
Here is my code, which I wrote knowing that it wouldn’t work. I am still a little mathematically challenged but I am working hard on it.
Code:
if (attackingPRIMARY) {
if (atPF >= atPS) {
attackingPRIMARY = false;
atPF = 0;
primaryRot = getRotation();
} else {
primaryRot += MathUtils.sin(atPF);
//primaryRot = getRotation() + MathUtils.sin(atPF);
atPF++;
}
}
any ideas on how I could get a nice swing going? When I draw, I use primaryRot for the rotation in case you didn’t guess. Thanks
-cMp