Hello.
I'm trying to draw a couple of different spritesheets using the same Texture2D, but as you may already understands, different sprites have different frames etc. So this does not work as I intended it to do.
Is there some way to use the same Texture2D and have different settings for different sheets? I don't want to create different textures for all enemies.
4 replies to this topic
Ad:
#2 Members - Reputation: 112
Posted 22 February 2012 - 08:07 AM
You would have to create a Sprite Map in some format (XML is a good choice). This map would define the location and size of each frame of each animation that's in your spritesheet. This gives your animations and spritesheets more flexibility as you don't need to follow a strict size/placement/number for each frame. In addition you can easily re-use sprites during animations.
So an example spritesheet map:
So an example spritesheet map:
<Object name="Enemy1"> <Sprites> <Image id="1" x="5" y="5" height="64" width="64"/> <Image id="2" x="69" y="69" height="102" width="50"/> </Sprites> <Animations> <Animation name="attack" fps="30" numFrames="3" loop="no"> <Frame sourceID="1"/> <Frame sourceID="2"/> <Frame sourceID="1"/> </Animation> <Animation name="Idle" fps="30" numFrames="1" loop="yes"> <Frame sourceID="1"/> </Animation> </Animations> </Object>
#3 Members - Reputation: 221
Posted 23 February 2012 - 04:35 AM
A while ago I was using HGE game engine and they have a custom resource script that they use to load your resources. Maybe if you take a look at their format you would get an idea how to do yours: http://hge.relishgam.../doc/index.html, choose "hgeResourceManager" on the left menu and then "Resource script" from the related information on that page.
#4 Members - Reputation: 129
Posted 23 February 2012 - 11:40 AM
I've played around a little with this tool for making my sprite sheets and plan in the coming weeks to integrate it's XML layout into my game content loader.
http://www.gamedev.n...ure-atlas-tool/
http://www.gamedev.n...ure-atlas-tool/


















