Python pygame.K_z() Examples
The following are 5
code examples of pygame.K_z().
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
pygame
, or try the search function
.
Example #1
Source File: sprites.py From gamedev with MIT License | 6 votes |
def get_keys(self): # TODO: add WASD? keystate = pg.key.get_pressed() if keystate[pg.K_LEFT]: if not self.beam_firing: self.rot_speed = PLAYER_ROT_SPEED if keystate[pg.K_RIGHT]: if not self.beam_firing: self.rot_speed = -PLAYER_ROT_SPEED if keystate[pg.K_UP]: self.acc = vec(0, -self.thrust_power).rotate(-self.rot) self.engine_emitter.count = 50 if keystate[pg.K_SPACE]: self.shoot() if keystate[pg.K_z]: self.hyper() if keystate[pg.K_x]: self.shoot_wpn2()
Example #2
Source File: pyint.py From Pyint_Pixel-Painter with GNU General Public License v3.0 | 5 votes |
def key_event_up(event): global penSize, undoed, holdingCTRL, colorScheme, selectedTool if event.key == pg.K_1: colorScheme = 1 elif event.key == pg.K_2: colorScheme = 2 if event.key == pg.K_e: selectedTool = 1 B_Buttons[1].clicked = True for subbutton in B_Buttons: if B_Buttons.index(subbutton) != selectedTool: subbutton.clicked = False elif event.key == pg.K_b: selectedTool = 0 B_Buttons[0].clicked = True for subbutton in B_Buttons: if B_Buttons.index(subbutton) != selectedTool: subbutton.clicked = False elif event.key == pg.K_g: selectedTool = 2 B_Buttons[2].clicked = True for subbutton in B_Buttons: if B_Buttons.index(subbutton) != selectedTool: subbutton.clicked = False elif event.key == pg.K_i: selectedTool = 3 B_Buttons[3].clicked = True for subbutton in B_Buttons: if B_Buttons.index(subbutton) != selectedTool: subbutton.clicked = False if event.key == pg.K_LCTRL: holdingCTRL = False if event.key == pg.K_SPACE: if holdingCTRL: g1.clean() undoed = True if event.key == pg.K_s: if holdingCTRL: shortcutPath = FileManager(1) SaveFile(g1, shortcutPath) if event.key == pg.K_z: if holdingCTRL: for i in range(g1.yCount): for j in range(g1.xCount): if round == 1: g1.change_color(j, i, g1.undoList[1][i][j]) if round == -1: g1.change_color(j, i, g1.undoList[0][i][j]) undoed = True
Example #3
Source File: battle.py From universalSmashSystem with GNU General Public License v3.0 | 5 votes |
def debugLoop(self): self.draw() pygame.display.update() try: for event in pygame.event.get(): if event.type == pygame.QUIT: self.exit_status = 1 self.debug_mode = False if event.type == pygame.KEYDOWN: if (event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT): self.debug_mode = False elif event.key == pygame.K_TAB: self.debug_console.set_trace() #Drop into the console elif event.key == pygame.K_LEFT: self.cameraX = -5 elif event.key == pygame.K_RIGHT: self.cameraX = 5 elif event.key == pygame.K_UP: self.cameraY = -5 elif event.key == pygame.K_DOWN: self.cameraY = 5 elif event.key == pygame.K_z: self.zoomVal = 0.01 elif event.key == pygame.K_x: self.zoomVal = -0.01 elif event.type == pygame.KEYUP: if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT: self.cameraX = 0 elif event.key == pygame.K_UP or event.key == pygame.K_DOWN: self.cameraY = 0 elif event.key == pygame.K_z or event.key == pygame.K_x: self.zoomVal = 0 for cont in self.controllers: cont.getInputs(event) self.stage.moveCamera(self.cameraX,self.cameraY) self.stage.zoomCamera(self.zoomVal) except bdb.BdbQuit: pass
Example #4
Source File: shooter8.py From gamedev with MIT License | 5 votes |
def events(self): for event in pygame.event.get(): # this one checks for the window being closed if event.type == pygame.QUIT: self.quit() # now check for keypresses elif event.type == pygame.KEYDOWN: # this one quits if the player presses Esc if event.key == pygame.K_ESCAPE: self.quit() # add any other key events here if event.key == pygame.K_UP: self.player.jump() if event.key == pygame.K_LEFT: self.player.go('l') if event.key == pygame.K_RIGHT: self.player.go('r') if event.key == pygame.K_SPACE: self.player.shoot() if event.key == pygame.K_z: self.spawn() elif event.type == pygame.KEYUP: if event.key == pygame.K_LEFT: self.player.stop('l') if event.key == pygame.K_RIGHT: self.player.stop('r')
Example #5
Source File: shooter-all.py From gamedev with MIT License | 5 votes |
def events(self): for event in pygame.event.get(): # this one checks for the window being closed if event.type == pygame.QUIT: self.quit() # now check for keypresses elif event.type == pygame.KEYDOWN: # this one quits if the player presses Esc if event.key == pygame.K_ESCAPE: self.quit() # add any other key events here if event.key == pygame.K_UP: self.player.jump() if event.key == pygame.K_LEFT: self.player.go('l') if event.key == pygame.K_RIGHT: self.player.go('r') if event.key == pygame.K_SPACE: self.player.shoot() if event.key == pygame.K_z: self.spawn() elif event.type == pygame.KEYUP: if event.key == pygame.K_LEFT: self.player.stop('l') if event.key == pygame.K_RIGHT: self.player.stop('r')