xna 4.0 c# rotate a collection of images -


me , team working on game in xna right now. we've run problem. open space sim players able build own ships (top down view) room room. each room has texture2d, since game top-down, need able "turn ship".

we're running problem rotating collection of texture2ds make ship. in our old code, tried rotate rooms around central origin location of bridge. had problems this, looked online , decided try our hand @ rendertargets (draw whole ship onto rt, rotate rt image when it's drawn). our problem rt draws big purple background and, since our ships aren't filled in rectangles, there's purple background somewhere poking out.

the question is: best way rotate collection of texture2ds around single origin in xna if single image?

your problem word-for-word exact same problem had until recently.

i had collection of compartments (for each of spaceships) rotating around origin, resulted in:

  1. large overhead calculating , reposition each , every compartment
  2. small gaps between compartments, due inaccuracies of float

i recommend go rendertarget approach. rid of purple background, use:

graphicsdevice.setrendertarget(render); graphicsdevice.clear(color.transparent); 

much less overhead , lot prettier without gaps between compartments.

all best , team, may best spaceship game win ;]


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -