Page 1 of 1

360 rotation ??

PostPosted: Sun Feb 13, 2011 11:50 pm
by BloodRaven
is there a 360 rotation ?? i used this code before, but in this case i got an animated character so i can't use this is there is any better way to rotate him ??
Code: Select all
double mouseangle = direction(xscreen, yscreen, xmouse, ymouse);
animpos = (mouseangle/360)*(nframes);

Re: 360 rotation ??

PostPosted: Mon Feb 14, 2011 2:29 pm
by Camper1995
Hello, I always rotate my sprites with this program. It's very simple and then you can use that code.
Code: Select all
double mouseangle = direction(xscreen, yscreen, xmouse, ymouse);
animpos = (mouseangle/360)*(nframes);

I think..... there are many game demos on the forum. ;)

Download link here:

http://info.sonicretro.org/RotSprite

Re: 360 rotation ??

PostPosted: Mon Feb 14, 2011 3:37 pm
by BloodRaven
Hello, I always rotate my sprites with this program. It's very simple and then you can use that code.

i took that code from your demo, :D :D :D
this only works if that sprites animation is rotating, my sprite animation is walking and i want to rotate him when he walks !!!

Re: 360 rotation ??

PostPosted: Mon Feb 14, 2011 8:57 pm
by skydereign
It's possible, a bit tricky/annoying though. You have two variables you can deal with, animpos and animindex. Your animation should be a single animindex, so instead of using animpos, you should use animindex. Do not that you can't change animindex like that, and have to use ChangeAnimation using getAnimName. That way the animpos can cycle normally. The trick is to have your animations lined up properly, as in 0-360 (I hope for your sake that is not the case).