This excellent video by Chris Wright gives an explanation of what a fugue is. The idea of a Subject and answer working point to point to give a textural melody.
This visualisation of Contrapunctus I shows the Subject followed by the answer, followed by another subject and answer how the fugue builds. Then the music starts it's first episode ending the exposition and starting the development of the subject and answer.
Fugues have it's own nuances and variation. An excellent explanation of Contrapunctus VII by Howard Goodall shows Retrograde, Inversion, Retrogradeinversion, augmentation, and diminuation.
A visualisation of Contrapuctus VII showing the voices throughout the piece