(if possibleand push any stars that are pushable moved makemove(mapobjgamestateobjplayermovetoif movedincrement the step counter gamestateobj['stepcounter'+ mapneedsredraw true if islevelfinished(levelobjgamestateobj)level is solvedwe should show the "solved!image leveliscomplete true keypressed false if the playermoveto variable is no longer set to nonethen we know the player intended to move the call to makemove(handles changing the xy coordinates of the player' position in the gamestateobjas well as pushing any stars the return value of makemove(is stored in moved if this value is truethen the player character was moved in that direction if the value was falsethen the player must have tried to move into tile that was wallor push star that had something behind it in this casethe player can' move and nothing on the map changes displaysurf fill(bgcolorif mapneedsredrawmapsurf drawmap(mapobjgamestateobjlevelobj['goals']mapneedsredraw false the map does not need to be redrawn on each iteration through the game loop in factthis game program is complicated enough that doing so would cause slight (but noticeableslowdown in the game and the map really only needs to be redrawn when something has changed (such as the player moving or star being pushedso the surface object in the mapsurf variable is only updated with call to the drawmap(function when the mapneedsredraw variable is set to true after the map has been drawn on line the mapneedsredraw variable is set to false if you want to see how the program slows down by drawing on each iteration through the game loopcomment out line and rerun the program you will notice that moving the camera is significantly slower if cameraup and cameraoffsety max_cam_x_pancameraoffsety +cam_move_speed elif cameradown and cameraoffsety -max_cam_x_panemail questions to the authoral@inventwithpython com