Designing a "Grid" like object that contains game objects

Posted by liortal on Game Development See other posts from Game Development or by liortal
Published on 2012-09-26T23:14:59Z Indexed on 2012/09/27 3:49 UTC
Read the original article Hit count: 295

Filed under:
|
|

I am working on a 2D game, where there's a game "board" on which other game objects are placed.

This this is 2D, my starting point was to design a class that will internally use a 2d array for the actual stored game objects.

This class could be simply accessed by 2 indices: (i, j) to get game objects on it.

My problem is that i have no idea how to make the game "board" "propagate" its data onto its children.

Design questions i ran into are:

  1. Should the children placed on the board have display properties such as size, screen position?
  2. Should the board itself dictate this information?
  3. How to update children in case the board changes some of its properties? (position, etc).
  4. Should the board be aware of the types of objects stored in it ?

I have no idea how similar things such as WPF or other UI frameworks go about organizing a "container like" object that can arrange or apply certain UI properties to its children.

© Game Development or respective owner

Related posts about c#

Related posts about architecture