Author Topic: How can I create a multi rowed sprite sheet in Flixel 2.x  (Read 1645 times)

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
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

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
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.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
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.

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
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 :)
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
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.

OmegaStorm

  • Member
  • **
  • Posts: 36
  • Karma: +0/-0
    • View Profile
    • OmegaStorm Productions
loadGraphic(CharImg, true, true);

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

For example:

loadGraphic(CharImg, true, true, 16, 16);

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Thank you so much for the help, it works perfectly now!!