Jump to content
  • Advertisement
Sign in to follow this  
AndersEkdahl

Creating many spriteSheets with same Texture2D

This topic is 2332 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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:

<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>

Share this post


Link to post
Share on other sites
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.relishgames.com/doc/index.html, 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
Thx for the replies!
I figured out a way to do this by just creating a big spritesheet and jump between different rows of the sheet, with Points. Works great :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!