def on_key_press(self, button: int, modifiers: int):
    'Called whenever a key is pressed.'
    if ((button in self.up) and self.physics_engine.can_jump()):
        self.player_sprite.change_y = PLAYER_JUMP_SPEED
        arcade.play_sound(self.jump_sound)
    elif (button in self.left):
        self.left_pressed = True
    elif (button in self.right):
        self.right_pressed = True
Called whenever a key is pressed.
def on_key_press(self, button: int, modifiers: int):
    
    if ((button in self.up) and self.physics_engine.can_jump()):
        self.player_sprite.change_y = PLAYER_JUMP_SPEED
        arcade.play_sound(self.jump_sound)
    elif (button in self.left):
        self.left_pressed = True
    elif (button in self.right):
        self.right_pressed = True