Exemplo n.º 1
0
def process_events():
    dead_enemies = enemies.intersection(health.killed)
    for entity_id in dead_enemies:
        score.award(entity_id)
        position = spatial.get_position(entity_id)
        explosions.create(position)
        manager.destroy_entity(entity_id)
Exemplo n.º 2
0
def process_events():
    enemy_ids = set(enemies)
    left_world = enemy_ids.intersection(collider.world_events)
    for entity_id in left_world:
        state = enemies[entity_id]
        amount = state.attempts
        if amount:
            state.state = IDLE
        else:
            score.award(entity_id)
            manager.destroy_entity(entity_id)
        state.attempts = amount - 1

    player_hit = enemy_ids.intersection(collider.collide_events)
    for entity_id in player_hit:
        health.apply_damage(player.player_id, DAMAGE)
        position = spatial.get_position(entity_id)
        explosions.create(position, big=False)
        manager.destroy_entity(entity_id)