Thread: sprite rotation in allegro

  1. #1
    Registered User
    Join Date
    Nov 2002

    sprite rotation in allegro

    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!

  2. #2
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    whats the prototype look like for the function?

  3. #3
    Registered User
    Join Date
    Jan 2003
    According to the manual at, 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.

  4. #4
    Rambling Man
    Join Date
    Jan 2002
    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.

  5. #5
    Registered User
    Join Date
    Nov 2002
    Im such an idiot!!! I forgot to convert to fix data type, sorry for such a pointles question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bullet start locations on a sprite after rotation
    By JeremyCAFE in forum Game Programming
    Replies: 13
    Last Post: 07-24-2006, 12:39 PM
  2. Sprite rotation
    By kawk in forum Game Programming
    Replies: 1
    Last Post: 01-25-2005, 01:39 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  5. problem in allegro with sprite leaving trail
    By Leeman_s in forum C++ Programming
    Replies: 18
    Last Post: 09-13-2002, 03:04 PM