Jump to content
  • Advertisement
Sign in to follow this  

sprite configuration

This topic is 4705 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

hey, i just loaded a bitmap onto the screen.well here is the code
#include <allegro.h>


int main(void)

    set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);

    BITMAP *bmp;
    PALETTE palette;
    bmp = load_bitmap( "sprite.bmp", palette );
            allegro_message("Error: could not load bitmap");

//main game loop
while ( !key[KEY_ESC] )
    draw_sprite( screen, bmp, 20, 20 );


return SUCCESS;



but see, problem is, all of the sprite figures show up, i just need to have one static image of the guy, not all his movements do i need to cut the image out myself or something?

Share this post

Link to post
Share on other sites
You need to use the blit function for that.
You can specify the frame you want to display by using the position of the sprite within the bitmap as parameter along with the width and height of a single sprite frame.

Look at the documentation for more information.

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!