The way a queue works is a single enemy leaves the room at a time, standing in front of the door. When that enemy is defeated, vacating that spot, the next in line from the room will drop down - assuming the heroes haven't already advanced in front of the door.
In the above example, the hero team defeats the white skeleton with a barrage of arrows, causing the red skeleton to "drop" down to replace it. However, when they kill the slime, they move forward into its space, preventing the next slime from dropping down. After defeating the red skeleton and moving into it's spot, then the slime door will be open again and a slime can drop down and attack the enemy from behind.
Enemies that are within one space of each other are considered to be grouped in combat. This means that for every turn the heroes make (warrior attacks, then archer fires bow), the enemy group gets a turn too. If an enemy is too far away, it is not in battle. At most, the heroes will be engaging in a single group in front of them, and potentially a single group behind them.
The game occurs in waves of hero teams coming through, with a brief respite between each wave in which the player can rearrange queues and build/upgrade rooms - possibly buy traps to add to hallway squares which don't feature doorways.
Basically, this is a game of planning ahead. Once the wave starts, you don't have any control over what happens. Instead, you line up all your enemies into a proper queue, hoping to pair compatible enemies and create specific combos that will decimate the enemy force (i.e. putting a slime that is easy defeated, then a heavy enemy which will drop behind the hero team and attack their weak flank). Since a wave may consist of multiple teams of heroes, you need to plan ahead and use the multitude of rooms and available enemies to create an impenetrable fortress.