From Sonic Retro
The Flying Battery Zone Sub-boss is one of the more bizzare boss battles of the Sonic series, with you battling a trap that looks like an animal prison. It also takes some thinking to figure out how to damage this guy, as he's immune to all direct attack. Every so often he sends one of his spiked balls (which other times float around to his upper left and upper right on chains) homing in on you. To defeat him stand on his plunger and wait for his eyes to blink; that's the signal that he's about to send a ball flying toward you. Then quickly run off the plunger, being careful not to touch a spiked ball. The spiked ball will hit the plunger, damaging him. Repeat six times and you've won.