View Full Version : sprite rotation in allegro
thedumbmutt
01-13-2003, 12:51 PM
Can someone try using rotate_sprite() in a .c file and then a .cpp file and see if they are having the same problem I am, It doesnt work for me if its saved as .cpp but does as .c. At least I think thats the problem, weird as hell!
Leeman_s
01-13-2003, 02:23 PM
whats the prototype look like for the function?
Vorok
01-13-2003, 05:31 PM
According to the manual at allegro.cc (http://www.allegro.cc/manual/view_function.php?_id=1308&request=1042500525&), the rotate_sprite function is as follows:
void rotate_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle);
What exactly is the problem you're having with it? Is the compiler giving you an error message?
One thing you might try is to write a quick piece of independant code that does nothing but display a rotated bitmap on the screen. That way you can see if the problem is in your implimentation of the function, or in something else in your program.
TechWins
01-13-2003, 11:25 PM
Typically when you use rotate_sprite() in a game you want your variables to be floats to get precies accuracy so here is what you would want to do...
float x, y, angle
rotate_sprite(buffer, sprite, int(x), int(y), ftofix(angle) );
I'm not exactly sure why a .c or a .cpp would cause a problem with it; if you have any problems you can either pm or continue to post here.
thedumbmutt
01-14-2003, 08:43 AM
Im such an idiot!!! I forgot to convert to fix data type, sorry for such a pointles question.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.