Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
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 1806 times)
0 Members and 1 Guest are viewing this topic.
Offline dah01

Junior Member


Medals: 7



« Posted 2011-12-31 05: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: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #1 - Posted 2011-12-31 07: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 09: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.

http://www.youtube.com/watch?v=oJPe6cWIC-Q

 

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

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #3 - Posted 2011-12-31 09: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 Member


Medals: 7



« Reply #4 - Posted 2012-01-01 16: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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (51 views)
2014-04-15 18:08:23

BurntPizza (47 views)
2014-04-15 03:46:01

UprightPath (63 views)
2014-04-14 17:39:50

UprightPath (45 views)
2014-04-14 17:35:47

Porlus (62 views)
2014-04-14 15:48:38

tom_mai78101 (86 views)
2014-04-10 04:04:31

BurntPizza (144 views)
2014-04-08 23:06:04

tom_mai78101 (243 views)
2014-04-05 13:34:39

trollwarrior1 (202 views)
2014-04-04 12:06:45

CJLetsGame (209 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org 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‑gaming.org
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!