Flixel Forums

development => help => Topic started by: sakurati on Wed, Oct 20, 2010

Title: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: sakurati on Wed, Oct 20, 2010
The number of frames for the main char sprite has become a large number, just wondering if there was a way to create a multirowed sprite sheet using Flixel 2.x
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: photonstorm on Wed, Oct 20, 2010
You can't *create* the sprite sheet using Flixel, but there are plenty enough packages that can. XnView (free) will string together a sequence of images into a single file for you, but there are plenty of others too.
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: sakurati on Wed, Oct 20, 2010
My sprite sheet image has become too big for flash to handle and its a long row of sprites. If I make a multirowed spritesheet image, how can I access it with Flixel 2.x?
I think I have misstated the creation of a sprite sheet by Flixel sorry about that.
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: photonstorm on Wed, Oct 20, 2010
Flixel doesn't need them to be in a single strip, you can wrap them onto as many lines as you need. As long as THAT doesn't blow Flashes limits too (in which case you've probably got a bigger problem somewhere :)
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: sakurati on Wed, Oct 20, 2010
Thanx for helping photonstorm. Iam still stuck with this. After rearranging the sprites I wrote the following function for the character

public function CharMax(X:Number, Y:Number)
{
   super(X, Y);
   loadGraphic(CharImg, true, true);
   width = 34;         
   height = 30;
   offset.y = 6;                  
   this.y -= this.height;   
   maxVelocity.x = 500;         
   acceleration.y = 2000;
   velocity.x = 300;
   addAnimation("walk", [12, 13, 14, 15, 16], 20, true);
   this.play("walk");      
}

I have made the image into a square now and put the sprites as an array. when I load the graphic image in Flixel, it loads the entire image instead of particular sprites. I dunno what I am doing wrong here.
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: OmegaStorm on Wed, Oct 20, 2010
loadGraphic(CharImg, true, true);

You left out the dimensions of the sprite when loading it.

For example:

loadGraphic(CharImg, true, true, 16, 16);
Title: Re: How can I create a multi rowed sprite sheet in Flixel 2.x
Post by: sakurati on Wed, Oct 20, 2010
Thank you so much for the help, it works perfectly now!!