Python pyglet.window.key.R Examples

The following are 1 code examples of pyglet.window.key.R(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyglet.window.key , or try the search function .
Example #1
Source File: player.py    From code-jam-5 with MIT License 6 votes vote down vote up
def on_key_press(self, button, modifiers):
        if button == key.R:
            self.weapon.reload()
            return

        # Avoid switching weapons while our current weapon is reloading
        # as that might be cheaty
        if self.weapon.reloading:
            return

        weapon = self.weapons.get(button)
        if not weapon:
            return

        if weapon.locked:
            return

        self.weapon = weapon