Codeception automatically makes screenshots on each test fail. (if you use Selenium web driver). Just check your tests/_log directory where Codeception saves screenshot of last shown page.
The name of screenshot is concatenation of failed cept/cest name and ".fail.png" (i.e. MyTestCept.php.fail.png).