Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (788)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (863)
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  
  Best way to load / Use sprites  (Read 4056 times)
0 Members and 1 Guest are viewing this topic.
Offline marinepower

Junior Devvie

Projects: 2

« Posted 2009-10-15 00:39:53 »

Hey guys, I've been wanting to incorporate more animation into my game, but I can't really figure out a good method of doing so.  As of now, I break up single .png images into smaller components, and then use those, but this method requires pixel-perfect alignment to work, which is a very tedious process.  This also makes it difficult to perfectly line up the sprites, especially for a quick demo.

Basically, the question boils down to:
What system do you guys use of loading and breaking up 2d frame by frame sprites into various components, and how would one do so without extensive pixel alignment?
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #1 - Posted 2009-10-30 08:01:00 »

I do it by turning on the grid in my graphics editing program.

or saving each frame to its own file.

Pixel alignment isn't that tedious is it?
Offline Bonbon-Chan

JGO Coder

Medals: 12

« Reply #2 - Posted 2009-10-30 10:01:51 »

I ending up to doing my own sprite editor with my own file format (PNG file with encoded data at the end). It is OK for most of my use.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel

Medals: 57
Projects: 11

Monkey for a head

« Reply #3 - Posted 2009-10-30 10:21:59 »

I keep single animation frames in individual image files (usually png) and have metadata (like animation sequences, collision data, etc.) in a seperate xml file. Animations have a sprite offset for every entry to allow me to line things up. And because I'm using Rebirth, tweeking them can be done on-the-fly while the game is running making it a lot easier and less tedious.

[ - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline princec

« JGO Spiffy Duke »

Medals: 1084
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #4 - Posted 2009-10-30 12:25:10 »

Chaz composes all the animations in multiple layers in Photoshop; he's then got a script that exports all the layers individually, all at the same size. I think he generally defines the actual XML part of the animations (which describes loops and timings) entirely by hand.

The exported layers are of course mostly transparent, so our sprite packer trims the pngs of all dead space and records an offset against the image so that we know to translate it before it's drawn. This combination of exporting identically sized layers and automating the trimming and offset calculation effectively puts an end to any tedious pixel alignment problems*.

Cas Smiley

* except, as we discovered, when shrinking sprites down to half size, as we discovered - that can be prone to occasional single-pixel offset rounding errors (correctable by super-faint pixels to fox the trimmer)

Pages: [1]
  ignore  |  Print  

hadezbladez (2205 views)
2018-11-16 13:46:03

hadezbladez (825 views)
2018-11-16 13:41:33

hadezbladez (2160 views)
2018-11-16 13:35:35

hadezbladez (430 views)
2018-11-16 13:32:03

EgonOlsen (3467 views)
2018-06-10 19:43:48

EgonOlsen (3704 views)
2018-06-10 19:43:44

EgonOlsen (2282 views)
2018-06-10 19:43:20

DesertCoockie (3019 views)
2018-05-13 18:23:11

nelsongames (3092 views)
2018-04-24 18:15:36

nelsongames (3909 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 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!