Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Slicing up sprite sheets for complex characters.  (Read 2214 times)
0 Members and 1 Guest are viewing this topic.
Offline dah01

Junior Devvie

Medals: 7

« Posted 2011-12-31 04:57:45 »

If not best practices, could someone provide an example?

The issues that I'm facing are that the artist I'm working with and I have a player character that we want to animate that will be around 32 wide by 64 high.

He may have a spear, which may be 128 long.

Should we create one sprite sheet for that character with all of the animation stuff manually specified with xml or should we create three sheets, 64x64, 128x128, 256,256, etc?

EDIT: Think like secret of mana, evermore, beyond oasis.

The issue is since java draws from top left coordinates then we'll have to be constantly concerned about the offset of the sprite since his location will be in reality x and y away from the location that the top left of his sprite needs to be drawn at.
Offline ra4king

JGO Kernel

Medals: 389
Projects: 3
Exp: 5 years

I'm the King!

« Reply #1 - Posted 2011-12-31 06:19:52 »

I'm not quite sure I understand what your problem is?

If your character is 32x64, then have all the frames of his animation in 1 image that is (n*32)x64 (n being the number of frames).

And the only thing you should be worrying about is the X and Y position of your character in world coordinates. You should only be converting to screen coordinates when drawing.

Offline StumpyStrust
« Reply #2 - Posted 2011-12-31 08:36:40 »

I think I understand what you are saying. Although I I may not be the best person to answer this.

Basically the drawing will be all screwy because the top left corner you are drawing from is changing do to different sized sprites.

One idea is to have a default size for all sprites for a character, say 64*64, even though the walk animation may only be 32*64.

The other is to have any spears/weapons/magic have their own sprite and be drawn on top of the character. This may make collisions for attacking easier.

The last idea would be to calculate the offset for the different sized sprites and add/subtract them from your drawing coordinates.
This I think is the best.

Here is a video to show what I think is going on for those with more expertise.


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel

Medals: 389
Projects: 3
Exp: 5 years

I'm the King!

« Reply #3 - Posted 2011-12-31 08:58:30 »

Oh! I see what the OP means now. The easiest way is to make the spritesheet as tall as the tallest frame then just add alpha above the smaller ones. In a separate file (like the XML file you mentioned) you would set the offset for bounds checking against certain frames.

Just like in StumpyStrust's video, but all in 1 spritesheet:

Offline dah01

Junior Devvie

Medals: 7

« Reply #4 - Posted 2012-01-01 15:38:21 »

Wow, there are so many ingenious tricks involving images. I'll have to check out this video, hopefully I can find some code samples?
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Coldstream24 (19 views)
2015-09-03 00:41:28

Andrew_3ds (31 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (15 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (32 views)
2015-08-29 11:30:54

GamerC4 (41 views)
2015-08-22 20:38:50

GamerC4 (37 views)
2015-08-22 20:37:18

GamerC4 (43 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!