Watch the video: https://youtu.be/i2EXKY3EQPo The dragon movement is not fluid. It's like if all the frames were changing at the same time. What am I doing wrong?
shipImage = al_load_bitmap("dragon_stationary.png");
ship.maxFrame = 5;
ship.curFrame = 0;
ship.frameCount = 0;
ship.frameDelay = 50;
ship.frameWidth = 180;
ship.frameHeight = 126;
ship.animationColumns = 5;
ship.animationDirection = 1;
//this occurs every 1/60 of a second
void drawShip(SpaceShip &ship, ALLEGRO_BITMAP *flyingShip) {
if (++ship.frameCount >= ship.frameDelay) {
if (++ship.curFrame >= ship.maxFrame) {
ship.curFrame = 0;
ship.frameCount = 0;
}
}
al_draw_bitmap_region(ship.image, ship.curFrame * ship.frameWidth, 0, ship.frameWidth, ship.frameHeight, ship.x, ship.y, 0);