5
\$\begingroup\$

What's the best way to have large animations in XNA 4.0? I have created a spritesheet with the sprite being 250x400 (more of an image than a sprite but hey ho) and there are approximately 45 frames in the animation. This causes problems for XNA as it says that the maximum filesize for Reach is 2048.

I'd rather not change to hidef as I heard that means that your game is less compatible with some computers and systems so does anyone have any idea what the best thing I could do is? The only thing I could come up with is to have a list of textures to flick through but that's not ideal.

\$\endgroup\$
  • 3
    \$\begingroup\$ How many active instances of the sprite are going to be active at once? \$\endgroup\$ – AttackingHobo Mar 1 '11 at 20:00
5
\$\begingroup\$

Since you wont answer my comment above I will give you a few options.

1 . Use a tilesheet that spans multiple Textures.

2 . Use a

List<Texture2D>

You can make this easier by making a png sequence with BigImage0001,BigImage0001,BigImage0001....

Import all of those.

Make a method that takes a name, Trailing numbers, and total frames. Have it return the built list of textures.

..

..

Use 1 if you have a lot of instances of the animation, that are playing at different frames, as it will reduce the amount of SpriteBatch calls XNA has to process.

Use 2 if you have a small amount of instances, it will reduce video memory consumption, but each instance more will increase the SpriteBatch calls.

\$\endgroup\$
  • \$\begingroup\$ I think this is the best alternative. Only one frame will be drawn, so it's no a huge deal if each frame is in a separate texture. (unless there are multiple instances) \$\endgroup\$ – Michael Coleman Mar 2 '11 at 3:48
  • \$\begingroup\$ Yeah, this seems like the best way, thanks. Sorry I didn't respond to your message before, but I was already in bed by then ^^ \$\endgroup\$ – Harold Mar 2 '11 at 6:22
4
\$\begingroup\$

Basically if you are targeting towards Direct9 then you can't use HiDef. You could always create a smaller animation and just set the scale to a higher amount(allowing it to zoom in on the image), if its a vectors image it won't skew the image.

\$\endgroup\$
  • 1
    \$\begingroup\$ XNA doesn't have built in support for vector graphics, if that's what you meant: forums.create.msdn.com/forums/p/65315/399906.aspx. So making the image smaller and scaling it up will cause some pixelation... depending on how scaled it is. \$\endgroup\$ – Venesectrix Mar 1 '11 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.