Made shooting with multiple buttons
This commit is contained in:
parent
cb82deed7b
commit
43883a0ee2
1 changed files with 3 additions and 1 deletions
4
game.py
4
game.py
|
@ -68,16 +68,18 @@ def play(window, options):
|
||||||
while PLAYING_GAME:
|
while PLAYING_GAME:
|
||||||
window.fill((0,0,0))
|
window.fill((0,0,0))
|
||||||
|
|
||||||
|
fired = False
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
logging.critical("Exiting Game...")
|
logging.critical("Exiting Game...")
|
||||||
PLAYING_GAME = False
|
PLAYING_GAME = False
|
||||||
return "QUIT"
|
return "QUIT"
|
||||||
|
|
||||||
if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
|
if event.type == pygame.KEYDOWN and event.key in [pygame.K_SPACE, pygame.K_w, pygame.K_UP] and not fired:
|
||||||
if not player.options["Sounds"]: Sounds["shot"].play()
|
if not player.options["Sounds"]: Sounds["shot"].play()
|
||||||
temp = Bullet(player, player.options["Textures"])
|
temp = Bullet(player, player.options["Textures"])
|
||||||
bullet_group.add(temp)
|
bullet_group.add(temp)
|
||||||
|
fired = True
|
||||||
|
|
||||||
if event.type == pygame.KEYDOWN and event.key == pygame.K_KP_PLUS:
|
if event.type == pygame.KEYDOWN and event.key == pygame.K_KP_PLUS:
|
||||||
if not player.options["Sounds"] or not player.OP:
|
if not player.options["Sounds"] or not player.OP:
|
||||||
|
|
Reference in a new issue