[math4] Animated Sprites -- Fortune Hunter

Justin Lewis jlew.blackout at gmail.com
Mon Apr 18 11:33:42 EDT 2011


The animated sprite class is used to do the animation.  You make a
sprite sheet and when constructing the animated sprite you pass in the
sheet cols and rows and it will be animated.

You can see in enemy.py an example

self.sprite = DynamicDrawableObject( Spritesheet(CHAR_PATH +
ENEMY[id]['img'] ).img_extract(col,row,width,height) , "", 24)

So to make a sprite sheet,

Create a sprite sheet object that takes in the path:

sp = Spritesheet(PATH)

Then you need to extract an array of images out of the sprtie sheet
using the img_extract method that takes in the number of collums and
rows and the width and height of the total image.  This method will
return a list of images.

sp_images = sp.img_extract( 3, 1, 100, 100)

That example will give you a list of 3 images (3 columns by 1 row
would give you three where 3 by 2 would give you 6...)

The dynamic DrawableObject can take in this list of images, empty
string (empty filename for this use), and a framerate.

The drawable object stuff is a bit fuzzy for me as that was added by
our art research team.

Justin Lewis
http://jlewopensource.com



On Mon, Apr 18, 2011 at 11:04 AM, 4s company software team
<fourscompany462 at gmail.com> wrote:
> Hello,
> Does anyone know anything about creating an animated sprite in Fortune
> Hunter?? We are trying to animate the effects of the spells (lighting strike
> when lightning attack chosen, etc.), but we are having a difficult time
> understanding how to implement this in the code...would we create new
> sprites in the enemy class, or do we need to use the animated sprite class?
>
> Thanks!
> Four's Company
> _______________________________________________
> FourthGradeMath mailing list
> FourthGradeMath at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/fourthgrademath
>
>


More information about the FourthGradeMath mailing list