Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Computer Graphics Exercises [2/9]

This program draws a horizontal line of discs at the top of the screen. Disc centers are 50 pixels apart and 15 pixels away from the top screen edge. Disc radius is 10 pixels.

Exercise:

Exercise 1 output image

Make another line of discs, but this one should be vertical. Disc centers should be 15 pixels away from the left screen edge.

Do not add another for loop, use just the given one. Make the loop draw another disc in each iteration, in addition to the disc drawn on top of the screen.

The disc function has the form:
disc(x, y, radius)

Hint

Which coordinate, x or y, increases downwards?

The solution is on the next slide.

Loading...