Jump to content



Creating many spriteSheets with same Texture2D

  • You cannot reply to this topic
4 replies to this topic

#1 oakvalley   Members   -  Reputation: 100

Like
0Likes
Like

Posted 22 February 2012 - 06:18 AM

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.

Ad:

#2 NickGomes   Members   -  Reputation: 112

Like
1Likes
Like

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:
<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 meeshoo   Members   -  Reputation: 221

Like
0Likes
Like

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 Bear Soul   Members   -  Reputation: 129

Like
0Likes
Like

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/

#5 oakvalley   Members   -  Reputation: 100

Like
0Likes
Like

Posted 26 February 2012 - 12:37 PM

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






We are working on generating results for this topic
PARTNERS