Пример #1
0
def collision_handler(state, collisions_list):
        for entity_name_1, entity_name_2 in collisions_list:
                if entity_name_1 == ENT_MAN:
                        if entity_name_2 == ENT_SHOT:
                                pass
                        elif entity_name_2 == ENT_GHOST:
                                entities.undo_last_move(state, ENT_MAN)
                                if not movers.get_active(state, ENT_GHOST)[0] == "wait":
                                        wait_mover.add(state, ENT_GHOST, 1.0, prepend=True)
                                        incr_health(state, -80)
                                        if get_health(state) <= 0:
                                                do_game_over(state)
                                else:
                                        entities.undo_last_move(state, ENT_GHOST)
                        elif entity_name_2[0:len(ENT_PREFIX_COINS)] == ENT_PREFIX_COINS:
                                incr_score(state, 10)
                                destroy_mover.add(state, entity_name_2, do_replace=True)
                        else:
                                entities.undo_last_move(state, entity_name_1)
                elif entity_name_1 == ENT_SHOT:
                        if entity_name_2[0:len(ENT_PREFIX_COINS)] == ENT_PREFIX_COINS:
                                pass
                        elif entity_name_2 == ENT_GHOST:
                                do_ghost_boom(state, entities.get_pos(state, ENT_GHOST))
                                destroy_mover.add(state, ENT_GHOST, do_replace=True)
                                do_shot_boom(state, entities.get_pos(state, ENT_SHOT))
                                destroy_mover.add(state, ENT_SHOT, do_replace=True)
                        else:
                                do_shot_boom(state, entities.get_pos(state, ENT_SHOT))
                                destroy_mover.add(state, ENT_SHOT, do_replace=True)
Пример #2
0
def collision_handler(state,
                entity_name_1,
                entity_name_2,
                collision_def_1,
                collision_def_2,
                absolute_shape_1,
                absolute_shape_2,
                contact_points,
                ):
        """
        TODO
        """
        entity_mover_1 = movers.get_active(state, entity_name_1)
        entity_mover_2 = movers.get_active(state, entity_name_2)
        if entity_mover_1 and entity_mover_1[0] == "physics":
                hit_physical_object(state, entity_name_2, entity_mover_2, entity_name_1, entity_mover_1)
        elif entity_mover_2 and entity_mover_2[0] == "physics":
                hit_physical_object(state, entity_name_1, entity_mover_1, entity_name_2, entity_mover_2)
Пример #3
0
def on_timer(state, last_frame_delta):
    phys_mover = movers.get_active(state, ENT_PLAYER_CAR)
    if phys_mover:
        exhaust_sprite_name = entities.get_active_sprite_name(
            state, ENT_PLAYER_CAR_EXHAUST)
        if not sprites.is_enabled(state, exhaust_sprite_name):
            do_exhaust(
                state,
                math_2d.get_radial_offset(
                    entities.get_pos(state, ENT_PLAYER_CAR), -0.25))
Пример #4
0
def collision_handler(
    state,
    entity_name_1,
    entity_name_2,
    collision_def_1,
    collision_def_2,
    absolute_shape_1,
    absolute_shape_2,
    contact_points,
):
    """
        TODO
        """
    entity_mover_1 = movers.get_active(state, entity_name_1)
    entity_mover_2 = movers.get_active(state, entity_name_2)
    if entity_mover_1 and entity_mover_1[0] == "physics":
        hit_physical_object(state, entity_name_2, entity_mover_2,
                            entity_name_1, entity_mover_1)
    elif entity_mover_2 and entity_mover_2[0] == "physics":
        hit_physical_object(state, entity_name_1, entity_mover_1,
                            entity_name_2, entity_mover_2)
Пример #5
0
def on_timer(state, last_frame_delta):
        phys_mover = movers.get_active(state, ENT_PLAYER_CAR)
        if phys_mover:
                exhaust_sprite_name = entities.get_active_sprite_name(state, ENT_PLAYER_CAR_EXHAUST)
                if not sprites.is_enabled(state, exhaust_sprite_name):
                        do_exhaust(state, math_2d.get_radial_offset(entities.get_pos(state, ENT_PLAYER_CAR), -0.25))