'Called when the player presses a key. See pyglet docs for key
mappings.
Parameters
symbol : int
Number representing the key that was pressed.
modifiers : int
Number representing any modifying keys that were pressed.'

def on_key_press(self, symbol, modifiers):

    if (symbol == key.W):
        self.strafe[0] -= 1
    elif (symbol == key.S):
        self.strafe[0] += 1
    elif (symbol == key.A):
        self.strafe[1] -= 1
    elif (symbol == key.D):
        self.strafe[1] += 1
    elif (symbol == key.SPACE):
        if (self.dy == 0):
            self.dy = JUMP_SPEED
    elif (symbol == key.ESCAPE):
        self.set_exclusive_mouse(False)
    elif (symbol == key.TAB):
        self.flying = (not self.flying)
    elif (symbol in self.num_keys):
        index = ((symbol - self.num_keys[0]) % len(self.inventory))
        self.block = self.inventory[index]
