Jump to content
  • Advertisement
Sign in to follow this  
mra

rotate_sprite problem (allegro)

This topic is 4768 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well im a noob to game programming so I thought I'd make a game with allegro. Everything is going great except that I can't get rotate_sprite to work. I have a 50 * 50 sprite with some transparent spots (255, 0, 255) and im trying to display it rotated on a 90 degree angle. This is what I did:
buffer = create_bitmap(1024, 768);
snake_head = load_bitmap("snake_head.bmp", NULL);
rotate_sprite(buffer, snake_head, head_x, head_y, 64);
blit(buffer, screen, 0,0,0,0,1024,768);
Well, I just put in the import parts, I skipped the rest. This gives me the same result as if I just drew the sprite with:
draw_sprite(buffer, snake_head, head_x, head_y);

Share this post


Link to post
Share on other sites
Advertisement
You should replace


rotate_sprite(buffer, snake_head, head_x, head_y, 64);


with


rotate_sprite(buffer, snake_head, head_x, head_y, itofix(64));


According to the Allegro documentation the rotate_sprite() function only accepts a fixed value (which are data structures defined by Allegro) as its last variable: you'll have to convert an integer to a fixed value using itofix(int yourvalue).
Or, if you need a fixed value out of a float or a double, use ftofix(float yourvalue).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!