#25436 - strider - Sun Aug 22, 2004 10:11 pm
Hey! just wondering how one would go about animating sprites. so far i know how to display sprites...to animate them would you just store each seperate frame as a different sprite in a sprites array and just draw the current frame on screen and all other frames off screen? or is there a more efficient way to animate sprites? any help would be great! thanks!
#25437 - zazery - Sun Aug 22, 2004 10:33 pm
I prefer to use DMA to write over the previous frame of the sprite I want to animate. It frees up the sprites which could be used for particles, a HUD etc. You don't really need more than one sprite per character unless you wanted to do some fancy things, which I'm sure you aren't at this stage. I have seen lots of people do it this way including commercial games. Use a finite state machine (FSM) to keep track of the frames and to know which one(s) to display in each state.
Hope that explains it a bit. I'm still learning animation myself.
#25449 - DialogPimp - Mon Aug 23, 2004 6:19 am
See http://forum.gbadev.org/viewtopic.php?t=3753 for how I did it.
It's up and running, along with a VB editor I use to piece it all together and generate the array declarations so I can confirm that the technique works.
#25862 - strider - Mon Aug 30, 2004 12:41 am
thanks guys...i read your thread/link and it helped... i was still wondering though, how do you guys store your sprites? do you have an individual picture/.c or .h file for each frame? or is it possible to load like an entire sprite sheet with all the frames and just display one portion/frame at a time?
#25863 - zazery - Mon Aug 30, 2004 3:01 am
Well there are many ways in doing that. Including header files most would say is a bad way of doing it. Since you are still learning you might like to do it this way. To expand on that idea, try adding the data to one big array and just change the starting value for your blitting loops.
The most proper way I have read about is including it as binary data. I believe Tepples' GBAFS is a good idea of what I am talking about. I've never done this as of yet but I plan to try it soon.
#25865 - dagamer34 - Mon Aug 30, 2004 4:56 am
zazery wrote: |
Well there are many ways in doing that. Including header files most would say is a bad way of doing it. Since you are still learning you might like to do it this way. To expand on that idea, try adding the data to one big array and just change the starting value for your blitting loops.
The most proper way I have read about is including it as binary data. I believe Tepples' GBAFS is a good idea of what I am talking about. I've never done this as of yet but I plan to try it soon. |
Including it as binary data is much easier on the compiler and really saves you some time in the long run.
_________________
Little kids and Playstation 2's don't mix. :(