In both games, the fight involves the player being trapped in a small room behind an impenetrable force field-like barrier. Within the room is a moving laser that is operated by Dr. Robotnik from a control panel just on the other side of the barrier. Once the boss is defeated, the barrier deactivates, allowing the player to proceed, and Robotnik escapes.
Sonic the Hedgehog 2
The player encounters Barrier Eggman at the end of Wing Fortress Zone in Sonic the Hedgehog 2. It is located at the cabin room of the air fortress where Dr. Robotnik is seen piloting the ship before the boss. After the Star Post, the player must destroy a small mine on the roof to enter the cabin room. After taking a small amount of rings, the player finds themselves being trapped between activated laser walls, while Dr. Robotnik himself is laughing on the right side of the room.
A small hatch on the ceiling opens and small spinning platforms with spikes below them will arrive to float around the trapped room. A moving laser cannon will also appear on the ceiling of the cabin room, which eventually stops to load its laser attack. It will then shoot the laser to the floor before starting to move in the player's direction. After five seconds, it will stop shooting, shut its laser cannon off, and repeat its pattern over again.
The only way to get out of this trapped room is to destroy the laser cannon. This is possible when it stops and starts loading the laser cannon to its full power. The player must use spinning platforms to reach the cannon, but they need to be careful not to touch the spiky undersides of the platforms, which can hurt the player. The player also must make sure to not get hit by the laser blast that the cannon will shoot after charging enough. The player will be able to tell how long they have until the laser fires by the rate it flashes as it gets closer to firing: The faster it flashes, the sooner its charge will be complete.
By hitting the cannon eight times, it will be destroyed, which ends the battle. Dr. Robotnik doesn't wait to see the results, as he is seen escaping to his space shuttle to travel to the Death Egg. After the player is freed from the trap room, Sonic arrives too late to the launch pad to stop the doctor, who has launched his space shuttle and takes off. After this, Tails arrives with the Tornado, now with a rocket add-on set below the biplane. After the sky chase, Sonic grabs hold of the ship and keeps hanging on until the space shuttle docks into the space station. The player will then progress to the last zone in the game.
Sonic & Knuckles
Barrier Eggman later returns in Sonic & Knuckles as sub-boss that the player encounters during Flying Battery Zone Act 2. The player will be trapped in a room in the ship's exit hall. Robotnik is also seen controlling the moving laser cannon on the ceiling himself this time (when the player controls Knuckles, Eggrobo can be seen controlling it).
In this version, there are no more spiked platforms (meaning that the player cannot attack the laser eye directly). Instead, the room becomes smaller every time that the laser is fired. To survive this fight, the player only needs to avoid the laser fire a certain number of times. Although the player must survive the laser to win the fight, it is possible to hit the laser cannon's eye, but doing this will not have any affect on the fight.
Eventually, so much of the room is damaged that the barrier falls on its own. Robotnik panics, and escapes to the outside of the air fortress. After that, the player will follow Robotnik to the outside and must to pass through the last platforming section of the zone, where a long platform will raise up which the player must stay clear of until the end of the route, or they will eventually be crushed between the long platform and the ceiling. After this, the player will be able to ride up on the long platform for a moment, when the zone's boss (the Hang Mobile) arrives.
In other media
Sonic the Comic
The Sonic the Hedgehog 2 version of Barrier Eggman was featured in Sonic the Comic #6, "Attack on the Death Egg", in which Sonic returns to the Wing Fortress some time after the events of Sonic the Hedgehog 2 to find that the defenses have been left running on automatic. Having defeated the system before, he easily does so again by leaping onto a spiked platform and then hitting the laser cannon with a Spin Attack.
When a second player is controlling Tails during the Sonic the Hedgehog 3 & Knuckles version of this boss, the second player can pass through the invisible wall in front of Robotnik.
In Sonic the Hedgehog 2, if Sonic doesn't follow Robotnik downwards and instead jumps over to the pilot seat after beating Barrier Eggman, there is a hidden Extra Lifemonitor to be found.
The laser originally made no sound effects in Sonic the Hedgehog 2, but its Sonic & Knuckles sound effects were added in the 2013 mobile re-release.