Depends on how complex animations you have. I usually have an integer holding which animation frame it is, then using an algorithm to get the proper picture from the bitmap, ie:
Originally posted by Leeman_s
Say I have one big bitmap with all the diff. pictures for a guy walking, or i had all diff. bitmaps for it. Either way, I'm wondering if this would work:
I could declare an integer whose value is 10, and decrement it each time the user hits the key that moves the guy. then when i draw the guy to the screen, i check where the int is at and then put it in a switch statement and depending what it is it will display one of the states of the walking position. and when it gets to zero, reset it to 10. (assuming there are 10 diff walking positions). is this a way to do it or is there something more efficient?