Entity Files
1,720
0
Advertisement
I've finally done away with the sprite data files and put the data directly in to the entity-XML file. Now the object type, name, collision model, image filenames and type info (diffuse, normal, etc), all the sprite animation data, and actions (sprite linkage) are all in one file for each entity. The original plan was to have separate collision, sprite, and entity data files in case objects needed to share resources. It was an attempt to be efficient and flexible (during my failed 3d project), but ultimately naive because I had no clue what the real needs would be. As it turns out, I need all the data for an entity to be in one file to keep things clean... my projects aren't huge.
I used to have the filename of the sprite-text file in the entity-XML, and would load it separately. The text file looked like this:
Now there's a data node in the XML file with child nodes for each sequence. I couldn't bear to put each little bit of data in it's own XML node, so I'm keeping the raw data in the same form as the text file. It looks like this:
What's missing from the above are Action nodes that define how sequences link together in a complicated sprite. The Saga City robot had to link it's arms and torso to the legs sequence each time the action changed (idle to running, for instance).
The ninja described in the file above is the entity I'm using to experiment with gameplay feel. More on that soon.
I used to have the filename of the sprite-text file in the entity-XML, and would load it separately. The text file looked like this:
SEQUENCES 9idleFRAMES 2timestep 400PIVOTS 0 [(15 17) 0 0 32 32 ][(15 17) 32 0 32 32 ]runFRAMES 3 timestep 100PIVOTS 0 [(15 17) 64 0 32 32 ][(15 17) 96 0 32 32 ][(15 17) 128 0 32 32 ]duckFRAMES 2timestep 400PIVOTS 0[(15 17) 192 0 32 32 ][(15 17) 224 0 32 32 ]... you get the ideaNow there's a data node in the XML file with child nodes for each sequence. I couldn't bear to put each little bit of data in it's own XML node, so I'm keeping the raw data in the same form as the text file. It looks like this:
"1.0" ?>"ninja" type="4"> "ninjaBody"> "0.000" y="0.0" angle="0.000" /> static="0" sleeps="1" fixedRotation="0" mass="0.000" /> "ninjaCircle" type="0"> "0" density="0.700" friction="0.500" restitution="0.100" collisionProfile="2" /> "0.5" x="0.000" y="0.000" /> > "ninja.png" type="0" /> "32" > "idle" frames="2" timestep="400" pivots="0" > [(15 17) 0 0 32 32 ] [(15 17) 32 0 32 32 ] "run" frames="3" timestep="100" pivots="0" > [(15 17) 64 0 32 32 ] [(15 17) 96 0 32 32 ] [(15 17) 128 0 32 32 ] "duck" frames="2" timestep="400" pivots="0" > [(15 17) 192 0 32 32 ] [(15 17) 224 0 32 32 ] "slide" frames="1" timestep="0" pivots="0" > [(15 17) 160 0 32 32 ] "sword" frames="3" timestep="200" pivots="0" > [(15 17) 0 32 32 32 ] [(15 17) 32 32 64 32 ] [(15 17) 96 32 64 32 ] "throw" frames="2" timestep="200" pivots="0" > [(15 17) 0 32 32 32 ] [(15 17) 160 32 32 32 ] "jump_up" frames="4" timestep="60" pivots="0" > [(15 17) 0 64 32 32 ] [(15 17) 32 64 32 32 ] [(15 17) 64 64 32 32 ] [(15 17) 96 64 32 32 ] "jump_down" frames="2" timestep="200" pivots="0" > [(15 17) 128 64 32 32 ] [(15 17) 160 64 32 32 ] "wall" frames="1" timestep="0" pivots="0" > [(15 17) 224 64 32 32 ] What's missing from the above are Action nodes that define how sequences link together in a complicated sprite. The Saga City robot had to link it's arms and torso to the legs sequence each time the action changed (idle to running, for instance).
The ninja described in the file above is the entity I'm using to experiment with gameplay feel. More on that soon.
Advertisement
Advertisement
Advertisement
Discussion