Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Sprite sheet frame problem

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 1st Apr 2015 22:27
Hi.

I have spaceship sprite with 16 frames.now I want create a sheet from them. but when I create Sprite sheet (with any tools) frames aren't correct.

like this picture:



Please guide Me to fix it.

Thanks.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Apr 2015 12:15 Edited at: 2nd Apr 2015 12:16
You can add animation frames to a sprite manually using LoadSubImage and AddSpriteAnimationFrame.

You need a subimages text file for the spritesheet though.

EDIT: What software are you using to create this image?

Using AppGameKit V2 Tier 1
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 2nd Apr 2015 12:41 Edited at: 2nd Apr 2015 15:55
Probably easiest and most beneficial to just hack the subimages file with the correct values. I mean, assuming the sprites are 64x64...

0.png:0:0:64:64
1.png:64:0:64:64
12.png:128:0:64:64
14.png:192:0:64:64

10.png:0:64:64:64
11.png:64:64:64:64
13.png:128:64:64:64
15.png:192:64:64:64

2.png:0:128:64:64
4.png:64:128:64:64
5.png:128:128:64:64
8.png:192:128:64:64

3.png:0:192:64:64
6.png:64:192:64:64
7.png:128:192:64:64
9.png:192:192:64:64

Another option would be to add a pixel at the top left of each sprite and rearrange them with an art package - the pixel at the top left helps to ensure that they are all aligned the same. I tend to load up the image, add the top left pixel, then resize the canvas to allow some scrath work area, then shift it all about before setting the canvas size back again.

Of course, if these are just sprites, then you could just set the sprite animation to suit, and forget the subimages file - but this would require the sprites to be in the correct order on the image. Subimages are mostly for separating the frames, like if you wanted to texture a frame onto a 3D object, you could extract a subimage from it - sprites mostly don't need that.

It does look cool - a pretty nicely drawn ship there, kinda reminds me a bit of Xenon2, but maybe with a 60's sci-fi feel to it too.

I am the one who knocks...
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 2nd Apr 2015 15:37
I feel this is one area where the manual (and the agk book) are weak. Sprite sheets are commonly used for exactly this purpose (animated sprites) but best practices are not covered in either manual.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 2nd Apr 2015 21:18 Edited at: 2nd Apr 2015 21:34
Quote: "You can add animation frames to a sprite manually using LoadSubImage and AddSpriteAnimationFrame."


I added animation frames to a sprite with AddSpriteAnimationFrame but Problem is I can't change animation when Press Left or Right Key.

Main.agc:



Player.agc




Quote: "You need a subimages text file for the spritesheet though."


yes, but maybe other engines don't support text file. I want find a Problem for it that can use in anywhere.

Quote: "EDIT: What software are you using to create this image?"


My software are:

1- AppGameKit ImageJoiner
2- TexturePacker
3- Sprite Sheet Packer
Dead Pixel
9
Years of Service
User Offline
Joined: 27th Nov 2014
Location:
Posted: 2nd Apr 2015 23:21
I also had a problem with the AppGameKit ImageJoiner not adding the images to the spritesheet in the order I wanted. I named them A.png, B.png, etc. When that didn't work I used numbers - 1.png, 2.png, etc. That didn't work either, ImageJoiner stiil had the sequence messed up so after a search on the the net I found Sprite Sheet Packer and it added them in the correct sequence. All I had to do then was edit the text file generated by ImageJoiner to reflect the sequence in the spritesheet.

//******************************
// Coding In BASIC using AppGameKit V2
//******************************
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Apr 2015 10:48
You shouldn't need the text file - really that's just for if you use 3D or need to separate a frame from the master image.

I don't think you can get away from the task of rearranging the sprite sheet in an art package - at least then you just have to animate the sprite.

I am the one who knocks...
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 3rd Apr 2015 14:06 Edited at: 3rd Apr 2015 14:08
I find a tool for create sprite sheet without Problem. it's Photoshop Sprite Sheet Generator Script and you can find it at below link.

http://www.johnwordsworth.com/projects/photoshop-sprite-sheet-generator-script/

Login to post a reply

Server time is: 2024-11-23 10:48:32
Your offset time is: 2024-11-23 10:48:32