So I have finally managed to get mostly everything in the project working, or at least everything that should relate to the UI, and was hyped to finally be able to do some hands on testing on stuff like piece movement, but when I started the UI, it became quickly apparent that something is not working.
The game does seem to play in the background, but it stays at this view:
Every now and again the preview for the next piece changes, faster so if I hold the down key, and eventually I reach the game over screen, but I don’t actually get to see the game, no matter what I do.
In previous projects I had UI issues, too, but in those projects I had no reason to beliefe that the mistake was on my end, and the eval tests confirmed my assumptions that the UI itself was bugged, but with this project having us implement stuff like the gameObservers I am unsure of if this time it is an issue I should take seriously.
tl;dr: UI not working properly, want confirmation that this is an issue with my code, and, if that is supposed to be public knowledge that I missed, information on what parts of the code the UI needs to display the game properly.
I invoke the observer methodes whenever applicable, and I see no reason why addObserver should not work the way I implemented it.
edit: I guess it could be that there is a situation where we are supposed to inform observers but I don’t. I reread the pdf, and it occured to me that some of the phrasings could be interpreted in different ways. For example it is unclear whether we’re supposed to be informing the observers via picePositionChanged() when we place the very first piece. Either way, the actual moveDown() etc. functions inform their observers, so I feel like if the UI changes whenever it is informed that something happened it should work. Especially since it does update whenever nextPiece changes or gameOver happens.
Can you please tell us where the problems were, so we can improve the UI for future iterations of this course?
Regarding this GUI problem:
The UI expects the board variable of the game to be always the same variable that mutates.
When overriding it with a new variable, the GUI loses its connection to the board.