Ejemplo n.º 1
0
def update(dt):
    global collected, collected_change
    for entity_id, state in evoseeds.iteritems():
        max_health = state.max_health
        current_health = health.get_health(entity_id)
        if current_health > max_health:
            continue

        position = spatial.get_position_vec(entity_id)
        timeout = state.timeout - dt
        if timeout < 0:
            explosions.create_within_radius(position, state.radius, big=False)
            timeout = state.explode_timeout
        state.timeout = timeout

        nearest_collector, collector_position, collector_distance = spatial.nearest(
            entity_id, [collector_id], threshold=DEFAULT_COLLECTOR_THRESHOLD)
        if nearest_collector:
            pull_strength = 1 - collector_distance / DEFAULT_COLLECTOR_THRESHOLD
            drift_direction = (collector_position - position).normalized()
            drift = drift_direction * pull_strength * DRIFT_SPEED * dt
            spatial.move_vec(entity_id, drift)

    for entity_id, recipient_id in collect_events:
        addition = health.get_health(entity_id)
        health.heal(recipient_id, addition)
        collected += 1
        collected_change = True
        manager.destroy_entity(entity_id)
Ejemplo n.º 2
0
def process_events():
    global collect_events
    collect_events = []

    seed_ids = collider.collide_events.intersection(evoseeds)
    for seed_id in seed_ids:
        collide_ids = collider.collide_events_data[seed_id]
        if collector_id in collide_ids:
            current_health = health.get_health(seed_id)
            max_health = evoseeds[seed_id].max_health
            if current_health > max_health:
                continue
            collect_events.append((seed_id, collector_id))
Ejemplo n.º 3
0
def first_update():
    score_str = "%010d" % score_mod.total
    text.set_text(score_id, score_str)

    player_id = player.player_id
    current_health = health.get_health(player_id)
    shield_str = ">" * current_health
    text.set_text(shield_id, "[%s]" % shield_str)

    requirement = player.get_next_upgrade_requirement()
    if requirement:
        collected_str = "%d" % (requirement - evoseed.collected)
    else:
        collected_str = "at maximum"
    text.set_text(progress_id, collected_str)

    text.set_text(weapon_id, player.current_weapon)
Ejemplo n.º 4
0
def update():
    if score_mod.new_score:
        score_str = "%010d" % score_mod.total
        text.set_text(score_id, score_str)

    player_id = player.player_id
    if player_id in health.damaged or player_id in health.healed:
        current_health = health.get_health(player_id)
        shield_str = ">" * current_health
        text.set_text(shield_id, "[%s]" % shield_str)

    if evoseed.collected_change or player.current_path_changed:
        requirement = player.get_next_upgrade_requirement()
        if requirement:
            collected_str = "%d" % (requirement - evoseed.collected)
        else:
            collected_str = "maximum"
        text.set_text(progress_id, collected_str)

    if player.current_weapon_changed:
        text.set_text(weapon_id, player.current_weapon)