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 > Sprite Animation

#165569 - zc00gii - Sun Dec 28, 2008 7:22 am

I looked in the libnds tutorials for sprite animation tutorial with no success. I am wanting to rotate a normal 256c sprite image. I would like to know how I would go about doing it. Any help will be greatly appreciated. Thank you for your time :D

#165578 - silent_code - Sun Dec 28, 2008 8:44 pm

I'm on the PS3, so this going to be brief: look for rotoscale sprites. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#165580 - zc00gii - Sun Dec 28, 2008 9:22 pm

couldn't find it :\
All I found was rotscale_text

#165585 - nyarla - Mon Dec 29, 2008 3:39 am

aka affine sprites :)

Patater's tutorial (see www.patater.com) goes into sprite rotation..

Also, check out the Sprite_Bitmap example which comes with devkitARM - it shows how to rotate sprites using the new libnds sprite api..

(btw, the Sprite_Bitmap example shows three sprites - a direct bitmap, a 256 colour and a 16 colour sprite.. only the bitmap sprite is set to rotate, so if you run it on no$gba it will look like it's doing nothing, since no$gba doesn't display bitmap sprites properly...

To make the other sprites rotate, you'll have to set their rotation index to 0, like the bitmap sprite.. so have a look at the bit where the three sprites are created.. the number right after each SpriteColourFormat bit is the rotation ID. change 2nd and 3rd sprites' from -1 to 0.)

#165587 - zc00gii - Mon Dec 29, 2008 4:36 am

I mean filmstrip animation. I don't want to load half a dozen sprites for one sprite animation.

#165588 - nyarla - Mon Dec 29, 2008 4:49 am

I'm not sure what you mean.

Are you talking about making a sprite strip containing frames of the sprite at different angles?

You could just use 1 sprite frame and have the DS rotate it for you. That is what the above posts are about. :)

#165590 - zc00gii - Mon Dec 29, 2008 5:16 am

what if I want a frame going up, down, left, right. a RPG sprite like Ness or Pokemon games
And yes, a sprite strip containing frames

#165592 - dovoto - Mon Dec 29, 2008 5:45 am

Hmm....good idea for an example. I will add one tonight.
_________________
www.drunkencoders.com

#165593 - zc00gii - Mon Dec 29, 2008 5:58 am

thanks, add a attachment or something as I need it soon(no rush ;) )

#165599 - dovoto - Mon Dec 29, 2008 5:36 pm

zc00gii wrote:
thanks, add a attachment or something as I need it soon(no rush ;) )


http://rafb.net/p/hJr7wB38.html

Adding the example to the example pack in the svn sometime today ish. Here is a zip if you must have it now!

www.drunkencoders.com/temp/RPG_sprites.zip
_________________
www.drunkencoders.com

#165600 - zc00gii - Mon Dec 29, 2008 5:42 pm

thanks :D this will help me out a lot. and in the
Code:

   int frame = sprite->anim_frame + sprite->state * 3;

part of the animateMan function, is sprite->state * 3; for three frames per row correct?

#165601 - dovoto - Mon Dec 29, 2008 7:03 pm

zc00gii wrote:
thanks :D this will help me out a lot. and in the
Code:

   int frame = sprite->anim_frame + sprite->state * 3;

part of the animateMan function, is sprite->state * 3; for three frames per row correct?


yeah, the sprites where generated using this badass little site (man.png and woman.png are in the sprites directory):

http://charas-project.net/charas2/index.php

I had someone resize them so they fit into 32x32 tile squares to make loading them simpler for the example.

Hope it helps.
_________________
www.drunkencoders.com