360 rotation ??

Non-platform specific questions.

360 rotation ??

Postby BloodRaven » Sun Feb 13, 2011 11:50 pm

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);
blooDRaven
User avatar
BloodRaven
 
Posts: 52
Joined: Sun Jul 26, 2009 11:53 am
Location: India
Score: 1 Give a positive score

Re: 360 rotation ??

Postby Camper1995 » Mon Feb 14, 2011 2:29 pm

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
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: 360 rotation ??

Postby BloodRaven » Mon Feb 14, 2011 3:37 pm

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 !!!
blooDRaven
User avatar
BloodRaven
 
Posts: 52
Joined: Sun Jul 26, 2009 11:53 am
Location: India
Score: 1 Give a positive score

Re: 360 rotation ??

Postby skydereign » Mon Feb 14, 2011 8:57 pm

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).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest