When should a bullet texture be loaded in XNA?
Posted
by
Bill
on Game Development
See other posts from Game Development
or by Bill
Published on 2011-03-04T04:46:59Z
Indexed on
2011/03/04
7:32 UTC
Read the original article
Hit count: 388
I'm making a SpaceWar!-esque game using XNA. I want to limit my ships to 5 active bullets at any time. I have a Bullet DrawableGameComponent
and a Ship DrawableGameComponent
. My Ship has an array of 5 Bullet.
What is the best way to manage the Bullet textures? Specifically, when should I be calling LoadTexture
? Right now, my solution is to populate the Bullet array in the Ship's constructor, with LoadTexture
being called in the Bullet constructor. The Bullet objects will be disabled/not visible except when they are active. Does the texture really need to be loaded once for each individual instance of the bullet object? This seems like a very processor-intensive operation.
Note: This is a small-scale project, so I'm OK with not implementing a huge texture-management framework since there won't be more than half a dozen or so in the entire game. I'd still like to hear about scalable solutions for future applications, though.
© Game Development or respective owner