Sign in to follow this  
AndersEkdahl

Creating many spriteSheets with same Texture2D

Recommended Posts

AndersEkdahl    100
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.

Share this post


Link to post
Share on other sites
NickGomes    142
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:
[code]
<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>
[/code]

Share this post


Link to post
Share on other sites
meeshoo    512
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: [url="http://hge.relishgames.com/doc/index.html"]http://hge.relishgames.com/doc/index.html[/url], choose "hgeResourceManager" on the left menu and then "Resource script" from the related information on that page.

Share this post


Link to post
Share on other sites
Bedspa    132
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.

[url="http://www.gamedev.net/topic/620583-the-ultimate-texture-atlas-tool/"]http://www.gamedev.net/topic/620583-the-ultimate-texture-atlas-tool/[/url]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this