I have a simple tetris game, and I want to add a save game and a load game method. I used serialization to save the board(which is an array), and it creates the file successfully. When I load the gamefrom the file, nothing changes. The code runs fine, but it doesn't do what I want. Here is the questionable part:
I don't understand why the loadgame() method takes a parameter. Perhaps what you wanted involves that parameter in some way... but the code you have there just ignores whatever you pass in from the calling code.
posted 6 years ago
The parameter of the loadgame should be the current board which will be overwritten by the input file. After saving and loading the texts are written on the screen correctly and the game continues. The actual board doesn't change.