本文整理汇总了Python中gamestate.GameState.hero_fire方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.hero_fire方法的具体用法?Python GameState.hero_fire怎么用?Python GameState.hero_fire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gamestate.GameState
的用法示例。
在下文中一共展示了GameState.hero_fire方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_input
# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import hero_fire [as 别名]
def handle_input(log, END_GAME = False):
"""
Handles all external input,such as those keyboard and mouse.
"""
for event in pygame.event.get():
keys = pygame.key.get_pressed()
# Closing
handle_quit(event)
if keyboard.queue_prompt(event):
game_state.next_wave()
# Pausing game
if keyboard.pause_prompt(keys):
game_state.toggle_paused()
# Hero's movement
hero_dir = keyboard.movement(keys)
game_state.hero.change_direction(hero_dir)
#END_GAME
global game_state
handle_quit(event, END_GAME)
if keyboard.restart(event, END_GAME):
if game_state.mode == "FIXED":
new_choice = "DYNAMIC"
else:
new_choice = "FIXED"
game_state = GameState(new_choice)
log.refresh(new_choice)
log.first_row()
# Sound Adjustment
if keyboard.music_prompt(keys):
dj.switch_background_music()
if keyboard.increase_prompt(keys):
dj.increase_volume()
if keyboard.decrease_prompt(keys):
dj.decrease_volume()
# Shoot Laser
if keyboard.laser_prompt(keys):
if game_state.hero.laser_equipped:
game_state.hero.is_firing_laser = True
game_state.hero.fire_time = time.clock()
# Shoot Pew
if keyboard.pew_prompt(keys):
if game_state.hero.ok_to_shoot():
game_state.hero_fire()
dj.play_pew()