Skip to main content
3 events
when toggle format what by license comment
Jun 16, 2011 at 21:25 comment added BlueRaja - Danny Pflughoeft Then each Tile (class which represents a single tile displayed on the screen) would reference a single TileType. If enough of your tiles have unique behaviour that requires special code, you will want to use a class hierarchy instead.
Jun 16, 2011 at 21:25 comment added BlueRaja - Danny Pflughoeft Another note unrelated to my answer above/below: if you find yourself doing if/switch statements that simply return different types, you probably want those values to be part of the class instead. In your case, I would create a TileType class, which contains information (texture, save-file-letter, etc.) about each type of tile. Then to get a TileType from a letter, just search through your list of TileTypes, or if you're concerned about performance, store a static Dictionary<char, TileType> in the TileType class (you can fill it automatically in the TileType constructor).
Jun 16, 2011 at 6:00 history answered Jesse Emond CC BY-SA 3.0