starshipmeteors pygame but if it moves down the screen then the coordinate is increased by starship_speed of course we do not want our starship to fly off the edge of the screen and so test must be made to see if it has reached the boundaries of the screen thus tests are made to see if the or values have gone below zero or above the display_width or display_height values if any of these conditions are met then the or values are reset to an appropriate default we can now use these methods with player input this player input will indicate the direction that the player wants to move the starship as we are using the leftrightup and down arrow keys for this we can extend the event processing loop that we have already defined for the main game playing loop as with the letter qthe event keys are prefixed by the letter and an underbarbut this time the keys are named k_leftk_rightk_up and k_down when one of these keys is pressed then we will call the appropriate move method on the starship object already held by the game object the main event processing for loop is nowwork out what the user wants to do for event in pygame event get()if event type =pygame quitis_running false elif event type =pygame keydowncheck to see which key is pressed if event key =pygame k_rightright arrow key has been pressed move the player right self starship move_right(elif event key =pygame k_leftleft arrow has been pressed move the player left self starship move_left(elif event key =pygame k_upself starship move_up(elif event key =pygame k_downself starship move_down(elif event key =pygame k_qis_running false howeverwe are not quite finished if we try and run this version of the program we will get trail of starships drawn across the screenfor example