gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Need help in rendering tiles and key frame animations

#142138 - phoenix23 - Fri Oct 05, 2007 1:24 am

Hello all,

I am new to programming on the Nintendo DS. I've got the input system figured out in "libnds" and messed with the framebuffer mode. I have the following questions, and I'll be glad if someone can help me out.

1. I referred to Patater's manual, it demostrated how to display a sprite and a background. I need to know how can I display a level consisting of many tiles like those in a top down shooter or a side scroller.

2. How can you reject the background (e.g, the color magenta) in a sprite? Do you use gfx2gba for that?

3. How would one carry out animations? i.e how can I move on to the next frame of animation?


Thanks in advance...


Last edited by phoenix23 on Fri Oct 05, 2007 2:52 pm; edited 1 time in total

#142147 - phoenix23 - Fri Oct 05, 2007 6:30 am

I'd appreciate any tutorials that explain how to undergo keyframe animation and tiling of a number of different bitmaps using "libnds".
Some of the really good ones I referred to have these sections under development.

#142219 - M3d10n - Sat Oct 06, 2007 3:59 pm

The DS hardware background and sprite modes work nearly identically to the GBA ones, so most GBA tutorials on using those will apply to the DS.

If by saying "reject the color magenta" you mean "having one color of my choice transparent", that's easy: pixels using the first color palette entry (for both sprites and backgrounds) are always drawn transparent.

And for animations, well... just switch the sprite image every few frames to animate them?

#142220 - phoenix23 - Sat Oct 06, 2007 4:23 pm

Oh, thank you very much for that valuable insight. I shall look into GBA tutorials. I could find just one DS tutorial that was incomplete, but intended to answer all the questions I had.

About the keyframe animation, I know how one would do that in general, but I couldn't figure how would you do it on the DS.
What I was wondering was how would you access a particular frame of an image (say frame 3) in order to render it.
I did not know that the rendering pipeline is the same for the GBA and the DS. Once again, thanks bunches for that information :-)

#142256 - SaruCoder - Sun Oct 07, 2007 12:15 am

phoenix23 wrote:
What I was wondering was how would you access a particular frame of an image (say frame 3) in order to render it.


What I did was I had the whole animation in a bmp or some other raster file. I would know how big each frame was and from there I could calculate the offset to the i-th frame. Also, it helps if the frames were lined up in a column instead of a row in the bitmap.