I am creating a small puzzle game as a hobby project, but now the project has reached the point that there is quite a lot of code (about 1,500 lines). Although I tried to prevent this, the code became dirty. I definitely want to clear the code and make it more convenient and understandable while I still can.
There are 3 classes in my game that handle puzzle pieces:
class PieceController{
private arrayOfPieces;
private selectedPiece;
}
class Piece{
private pieceID
private ArrayOfPieceStates
}
class PieceState{
private stateDimensions
}
Probably, this structure should be redesigned as a whole, but suppose that it is now approx.
Problem: There is also a JPanel that takes care of the graphics, and he needs to know about the PieceState of the current puzzle piece to draw it. the panel drawing method then gets the dimensions with the type request:
PuzzleController.getPiece().getState().getDimensions()
, , . , break;
, " " :
PieceController.drawPiece(drawingInfo)
Piece.drawPiece(drawingInfo)
PieceState.drawState(drawingInfo)
( , drawingInfo acutal code - , .)
, drawPiece - , , . , .
: puzzlePiece .
: puzzlePiece state ( , , ).
, PieceState (, ), "".
, , , , . : ? , ?