Egg Gravity is a upgraded Egg Mobile that has gray and red spheres you can walk on, just like in the Egg Snake boss battle. The Egg Mobile is mostly blue with two gray lines on each side. Gemerl is located on the bottom of Egg Gravity.
Doctor Eggman is invincible and striking him will only result in you losing your rings. To attack, you must hit Gemerl, who is on the underside of the Egg Mobile. Eggman will be sent flying into a bed of spikes. All the while, Eggman and Gemerl are moving along a "line" in the center of the screen, moving faster after every hit. Walking on the bottom of it reverses gravity, so you'll be upside-down. Usually, Gemerl will be on the underside of the line, but Eggman can flip the machine around at any point. Eggman has two forms of attack: the first is to jump high into the air and slam down on the "line", sending you flying into the bed of spikes and spilling your rings (which are very hard to get back); this can be avoided by jumping away from the Egg Mobile just as Eggman comes down. The second attack (which he primarily uses in the latter part of the battle) is just after he's been sent into the spikes: he'll spin around, making himself totally invincible and move along the "line" at high speed. The best way to avoid him this time is to stay at the very edge of the arena (beside any of the tunnels) and jump as high as you can whenever he comes near you.