I’m wondering how can i tell the observer of what happen in each function? I don’t really understand how the GameObserver works.
The GameObservers are generally quite simple in design.
There are 4 ‘events’ that the game observers should be informed about, that are:
- Game Over
- Piece landed
- Piece Position Changed
- Rows Completed
and it’s as simple as it sounds, when one of these events occurs, the associated Observer method is called.
Your current piece is moved to the left → your game implementation calls the
piecePositionChanged() method from the Game Observer.
Please note that it should be possible to add more than one observer to a game, e.g. one for the AutoPlayer and one for the user interface.
This post could also be interesting for you