i am an absolute noob here and i really don't get whats going on. so i have a couple questions- how do you make a sprite sheet? how to use the sprite sheet-like how to use the sheet to make a character animated.
thanks
A fast, easy to use, free, and community supported 2D game engine
i am an absolute noob here and i really don't get whats going on. so i have a couple questions- how do you make a sprite sheet? how to use the sprite sheet-like how to use the sheet to make a character animated.
thanks
eh many ways, the easiest I find is to make the sprites in photoshop (say 32x32 or whatever size), then copy and paste the layers into a bigger document and align them properly.
You then have a sprite sheet, and you can create an animation from it using atlassprites and defining the regions of each sprite inside the sheet.
Take a look at the docs and most importantly the examples, it's all there.
hope it helps in some way!
As above, but use http://robertjpayne.com/textureatlascreator/ to put the sprites together on a sheet.
Then try the following (from the AtlasSpriteTest):
'
AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"grossini_dance_atlas.png" capacity:5];
[self addChild:mgr z:0 tag:1];
CGSize s = [[Director sharedDirector] winSize];
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 121, 85, 121) spriteManager: mgr];
sprite.position = ccp( s.width/2, s.height/2);
[mgr addChild:sprite z:i];
'
The values might all be wrong, but you get the idea.
Justin
thank you so much for all the help
I found a really cool photoshop script that takes all the layers in the file and saves them into a spriteSheet. This thing has saved me a ton of time.
I tried to use Sprite Sheet but it not works. The code is:
-----
AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"grossini_dance_atlas.png" capacity:50];
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0,121,85,121) spriteManager:mgr];
[mgr addChild:sprite z:0 tag:1];
[self addChild:mgr];
sprite.position = ccp( 100,150 );
sprite.scale = 1.0f;
-----
But I get a static image (the last image) and not the animation.
What is wrong?
You arent creating the Animation. Look in the tests folder for the AtlasSpriteTest.m example. See the code in the Atlas2 class to create the animation:
AtlasAnimation *animation = [AtlasAnimation animationWithName:@"dance" delay:0.2f];
for(int i=0;i<14;i++) {
int x= i % 5;
int y= i / 5;
[animation addFrameWithRect: CGRectMake(x*85, y*121, 85, 121) ];
}
You are missing a couple of steps.
You must log in to post.