cameraoffsety -cam_move_speed if cameraleft and cameraoffsetx max_cam_y_pancameraoffsetx +cam_move_speed elif cameraright and cameraoffsetx -max_cam_y_pancameraoffsetx -cam_move_speed if the camera movement variables are set to true and the camera has not gone past ( panned passedthe boundaries set by the max_cam_x_pan and max_cam_y_panthen the camera location (stored in cameraoffsetx and cameraoffsetyshould move over by cam_move_speed pixels note that there is an if and elif statement on lines and for moving the camera up and downand then separate if and elif statement on lines and this waythe user can move the camera both vertically and horizontally at the same time this wouldn' be possible if line were an elif statement 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 'solved pygame display update(draw displaysurf to the screen fpsclock tick(