the move_ip(method for rect objects will move the location of the rect object horizontally or vertically by number of pixels for exampleplayerrect move_ip( would move the rect object pixels to the right and pixels down to move the rect object left or uppass negative values for exampleplayerrect move_ip(- - will move the rect object left by pixels and up pixels the "ipat the end of move_ip(stands for "in placethis is because the method changes the rect object itselfrather than return new rect object with the changes there is also move(method which doesn' change the rect objectbut instead creates and returns new rect object in the new location adding new baddies add new baddies at the top of the screenif needed if not reversecheat and not slowcheatbaddieaddcounter + on each iteration of the game loopincrement the baddieaddcounter variable by one this only happens if the cheats are not enabled remember that reversecheat and slowcheat are set to true as long as the "zand "xkeys are being held downrespectively and while those keys are being held downbaddieaddcounter isn' incremented thereforeno new baddies will appear at the top of the screen if baddieaddcounter =addnewbaddierate baddieaddcounter baddiesize random randint(baddieminsizebaddiemaxsize newbaddie {'rect'pygame rect(random randint( windowwidth-baddiesize) baddiesizebaddiesizebaddiesize) 'speed'random randint(baddieminspeedbaddiemaxspeed) 'surface':pygame transform scale(baddieimage(baddiesizebaddiesize)) when the baddieaddcounter reaches the value in addnewbaddierateit is time to add new baddie to the top of the screen firstthe baddieaddcounter counter is reset back to line generates size for the baddie in pixels the size will be random integer between baddieminsize and baddiemaxsizewhich are constants set to and on lines and line is where new baddie data structure is created rememberthe data structure for baddies is simply dictionary with keys 'rect''speed'and 'surfacethe 'rectkey