if(kbhit()){
            getch();
            if(getch() == ' '){
                while(y9 < 770){
        readimagefile("PIX\\thunderball\\thunderball.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80);
        putimage(0, 0, background, COPY_PUT);
        readimagefile("PIX\\thunderball\\thunderball2.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80);
        putimage(0, 0, background, COPY_PUT);
        readimagefile("PIX\\thunderball\\thunderball3.gif", x9+10, y9+40, x9+40, y9+70);Sleep(80);
        putimage(0, 0, background, COPY_PUT);
        y9++;}}
        if(y9 == 730){
            readimagefile("PIX\\thunderball\\thunderball_contact.gif", x9, y9, x9+30, y9+30);Sleep(80);
            putimage(0, 0, background, COPY_PUT);
            readimagefile("PIX\\thunderball\\thunderball_contact2.gif", x9, y9, x9+30, y9+30);Sleep(80);
            putimage(0, 0, background, COPY_PUT);
            readimagefile("PIX\\thunderball\\thunderball_contact3.gif", x9, y9, x9+30, y9+30);Sleep(80);
            putimage(0, 0, background, COPY_PUT);
        }}
        break;

    default:
        readimagefile("PIX\\Character\\down_still.gif", x9, y9, x9+50, y9+50);
        putimage(0, 0, background, COPY_PUT);
    }
    }//end function

So, this is the code I have to animate my character shooting a lightning ball, then when it hits the wall it explodes with contact indicator. However, when I press space, it animates and slooooooooowy crawls towards the edge of the screen... Haha And during this slow crawl, it won't let me move my character. I am after getting this to move along the screen quickly and allow movement while doing so.

I feel my entire way of animating might be bad... This is the only way I have learned of doing it and I am using C since that is all I have learned (still learning) and I am very beginner so I don't know if I would understand how to animate something using some complex method...

But yeah if anyone has advice or suggestions on how to get it to animate properly I would love to hear it!

Thank you!

Readiing the images from file is probably taking ages. You would do better to read them all beforehand and store in memory.

Edited 3 Years Ago by Moschops

Ok, I am familiar with getimage and putimage. Is this what I want to do and just read them all before while loop (this animation is part of character function, which is in an infinite loop)?

This article has been dead for over six months. Start a new discussion instead.