The loop in slowMoveVertical pretty much locks you into drawing the sun in front. If your assignment allows you to bypass slowMoveVertical, then you can manually do the loop it does and render your sun and the hill yourself so the layering is right.
for(int i = 0; i < 190; i++) {
sun.moveHorizontal(1);
hill.draw();
}
edit...
There's a wait() at the end of the draw call, which would really only be used on the last object in the "batch". Making another draw method with an optional wait call allows the caller to control it instead of the circle. example...
public void draw() {
draw(true); // retain current behavior
{
public void draw(boolean useWait) {
if(isVisible) {
Canvas canvas = Canvas.getCanvas();
canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition,
diameter, diameter));
if (useWait) {
canvas.wait(10);
}
}
}
Now you can call sun.draw(false) and hill.draw(true) and it shouldn't flicker (or a at least a lot less).