keyup event occurs for the k_left keywe set moving_left to false we can use elif blocks here because each event is connected to only one key if the player presses both keys at oncetwo separate events will be detected if you run alien_invasion py nowyou should be able to move the ship continuously to the right and left if you hold down both keysthe ship should stop moving nextwe'll further refine the movement of the ship let' adjust the ship' speed and limit how far the ship can move so it doesn' disappear off the sides of the screen adjusting the ship' speed currentlythe ship moves one pixel per cycle through the while loopbut we can take finer control of the ship' speed by adding ship_speed_factor attribute to the settings class we'll use this attribute to determine how far to move the ship on each pass through the loop here' the new attribute in settings pysettings py class settings()""" class to store all settings for alien invasion ""def __init__(self)--snip-ship settings self ship_speed_factor we set the initial value of ship_speed_factor to when we want to move the shipwe'll adjust its position by pixels rather than pixel we're using decimal values for the speed setting to give us finer control of the ship' speed when we increase the tempo of the game later on howeverrect attributes such as centerx store only integer valuesso we need to make some modifications to shipship py class ship() def __init__(selfai_settingsscreen)"""initialize the ship and set its starting position ""self screen screen self ai_settings ai_settings --snip-start each new ship at the bottom center of the screen --snip- store decimal value for the ship' center self center float(self rect centerxmovement flags self moving_right false self moving_left false ship that fires bullets