I'm porting a 2D platformer and I need a good way of getting some extensibility out of my level tiles. I'm not sure if Decorator is correct here, but nothing else comes to mind. Maybe I need something unique.
Anyway, say I have a basic Tile that has things like it's image, and whether the player can pass through it (background or foreground). Now I want to add properties to them like making some tiles act as ladders, or making some hurt or kill the player on contact. Maybe some can disappear. Some properties can be combined.
This sounds like decorator, but I really don't like how that requires my base class to implement dummy versions of everything, like isLadder()
, isLethal()
, etc. Is there a better way? I'm not going to be the guy who changes my design just so it looks like something out of the GoF book.
Sorry if this has been asked a million times before, I didn't quite find it in the related questions.