mapneedsredraw true if islevelfinished(levelobjgamestateobj) level is solvedwe should show the "solved!image leveliscomplete true keypressed false displaysurf fill(bgcolor if mapneedsredraw mapsurf drawmap(mapobjgamestateobjlevelobj['goals'] mapneedsredraw false if cameraup and cameraoffsety max_cam_x_pan cameraoffsety +cam_move_speed elif cameradown and cameraoffsety -max_cam_x_pan cameraoffsety -cam_move_speed if cameraleft and cameraoffsetx max_cam_y_pan cameraoffsetx +cam_move_speed elif cameraright and cameraoffsetx -max_cam_y_pan cameraoffsetx -cam_move_speed adjust mapsurf' rect object based on the camera offset mapsurfrect mapsurf get_rect( mapsurfrect center (half_winwidth cameraoffsetxhalf_winheight cameraoffsety draw mapsurf to the displaysurf surface object displaysurf blit(mapsurfmapsurfrect displaysurf blit(levelsurflevelrect stepsurf basicfont render('steps% (gamestateobj['stepcounter']) textcolor steprect stepsurf get_rect( steprect bottomleft ( winheight displaysurf blit(stepsurfsteprect if leveliscomplete is solvedshow the "solved!image until the player has pressed key solvedrect imagesdict['solved'get_rect( solvedrect center (half_winwidthhalf_winheight displaysurf blit(imagesdict['solved']solvedrect if keypressed return 'solvedemail questions to the authoral@inventwithpython com