In both games, the fight involves the player 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 and where Dr. Robotnik also is seen to be piloting it before the boss. After the Star Post, the player has to destroy a small mine on the roof to enter the cabin room. After taking a small amount of rings, the player finds himself 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 cannon also appears to the ceiling of the cabin room, that eventually stops to load its laser attack. It will then shoot the laser to the floor and starts moving again towards the player's direction. After five seconds, it will stop shooting, shuts its laser cannon and repeats 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 has to use spinning platforms to reach the cannon, but the player has to watch out to not touch the spiky undersides of the platforms, which can hurt the player. The player also has watch out to not get hit by the laser blast that the cannon will shoot after loading it enough. The player is 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 closer it is to firing.
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 his space station 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 is docking into the space station. The player will then progress to 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 get trapped to the room on the exit hall. Robotnik is now also seen controlling the moving laser cannon at the ceiling himself this time. When the player controls Knuckles, Eggrobo normally is 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 event, the player only needs to avoid the laser fire for a certain number of times. Though the player must survive the laser to win the fight, it is possible to hit the laser cannon's eye, but it doesn't do anything.
Eventually, so much of the room is damaged that the barrier falls on its own and Robotnik panics, he escapes to the outside of the air fortress. After that, the player will follow Robotnik to the outside and has to pass through the last platforming section of the zone, where a long platform will raise up while the player has to keep running the route or he/she will eventually get crushed between the long platform and ceiling. After this, the player will be able to ride up with the long platform for the moment, when the zone's boss 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.
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.