def update(dt): for entity_id, state in cannons.iteritems(): hot = state.hot if hot: hot -= min(hot, dt) elif trigger.is_down(entity_id): hot = state.cooldown state.shoot_func(entity_id, state) state.hot = hot
def update(dt): for entity_id, state in launchers.iteritems(): hot = state.hot if hot: hot -= min(hot, dt) elif trigger.is_down(entity_id): hot = state.cooldown offset = state.offset player_only = state.player_only pos_x, pos_y, angle = spatial.get_position_and_angle(entity_id) bullet.create_missile((pos_x + offset, pos_y), angle, SPEED, IMAGE, entity_id, player_only=player_only) state.offset = -offset state.hot = hot state.trigger = False