MikeMcMahon / seed

Project Seed - written in C++ with directx
1 stars 0 forks source link

Sprite mapping #3

Open MikeMcMahon opened 13 years ago

MikeMcMahon commented 13 years ago

We need a DI like way of sprite creation, relying on code generated sprites is annoying.

Create an xml structure to define sprite creation. The files can be ingested and then used to generate all of the sprites for the game at once, only creating the texture resources when needed.

<sprites>
<sprite name="MyMainCharacter" type="character/npc/background" >
<textureMaps>
  <textureMap name="sheet1" 
                         resource="/path/to/texture/map.png"
                         height="512" 
                         width="512" 
                         cellSize="32" />
  <textureMap name="sheet2" 
                         resource="/path/to/texture/map.png"
                         height="64" 
                         width="512" 
                         cellSize="32" />
</textureMaps>
<!-- for characters / NPC we will identify their animations in almost the same exact way
but NPCs will have an additional field for setting default walk paths --> 
<path startDirection="Up">
  <pattern>UULL</pattern>
<path>
<animations>
  <animation name="walkingLeft" map="sheet1" duration="in-milliseconds" frames="4">
    <cellPosition x="3" y="2" />
  </animation>
</animations>
<!-- for backgrounds / tile sets we'll just map out where to find stuff in the tile set --> 
<tiles map="sheet2">
  <tile>
    <span x="1" y="1" />
    <cellPosition x="2" y="2" />
  </tile>
</tiles>
</sprites>
MikeMcMahon commented 13 years ago

Maybe I need to clarify some other points in here. Not sure yet, but I like the idea of being able to do a lot of initialization this way

MikeMcMahon commented 13 years ago

Things to consider for the movement pattern (since this is 2d sprite based)

U = UP D = DOWN L = Left R = Right PX = Pause / Duration (in milliseconds)