def detect_all_collisions(player): all_collisions = { 'BARRIER_KILLED': [], 'MOVING_OBJECT_KILLED': [], } for enemy in Enemy.instances: all_collisions = merge_into_list_dict( all_collisions, get_collision( barrier=enemy, moving_object=player, combat_collision=True ) ) return all_collisions
def detect_all_collisions(player): # 1. Fetch all possiple collisions all_collisions = { 'FLOOR': [], 'CEILING': [], 'LEFT_WALL': [], 'RIGHT_WALL': [], } for barrier in Barrier.instances: all_collisions = merge_into_list_dict( all_collisions, get_collision(barrier=barrier, moving_object=player)) # 2. Reduce all collisions to the relevant ones, example: # all_collisions['FLOOR'] = [3.0, 4.2, 2.2, 4.0] # -> relevant_collisions['FLOOR'] = 4.2 return reduce_to_relevant_collisions(all_collisions)
def detect_all_collisions(moving_player): # 1. Fetch all possiple collisions all_collisions = { 'FLOOR': [], 'OBJECTS_ON_TOP': [], 'OBJECTS_BELOW': [], 'LEFT_WALL': [], 'RIGHT_WALL': [], } for player in Player.instances: if player != moving_player: collision = get_collision(barrier=player, moving_object=moving_player, stacked_collision=True) all_collisions = merge_into_list_dict(all_collisions, collision) # 2. Reduce all collisions to the relevant ones, example: # all_collisions['FLOOR'] = [3.0, 4.2, 2.2, 4.0] # -> relevant_collisions['FLOOR'] = 4.2 return reduce_to_relevant_collisions(all_collisions)