c# - XNA - Using Game Components -
when should 1 use game components? used for, design pattern around them?
which better:
having background component, player component, spaceship component , various instances of enemy component, each 1 responsible updating , drawing itself;
having of above inside gameplay screen class, manages everything.
speaking of gameplay screen, game state management example didn't seem modular. better structure things in example, program entire screens @ once instead of reusable bits , pieces, or use game components achieve maximum modularity?
from msdn:
game components provide modular way of adding functionality game. create game component deriving new component either gamecomponent class, or, if component loads , draws graphics content, drawablegamecomponent class. add game logic , rendering code game component overriding gamecomponent.update,drawablegamecomponent.draw , gamecomponent.initialize. game component registered game passing component game.components.add. registered component have draw, update, , initialize methods called game.initialize, game.update, , game.draw methods.
talking of example, practice seperate components seperate classes. make lot easier manage project gets bigger.
here link more information gamecomponent , how/when use them.
Comments
Post a Comment