Pumpkin Carving
Your task is to create a pumpkin that matches the picture below. While creativity is encouraged, the main part of the assignment is to match the pumpkin given as closely as possible. You may use the built-in drawing tools from Princeton’s CS1 stdlib.jar file. Here are some tips and pointers
- Start drawing the background first – drawn elements appear on top of earlier elements
- You can use an RGB Color Picker to choose your colors. (The eyedrop will sample any color from your screen. Handy for “Blue Dress / Gold Dress” puzzles).
- The moon is 2 circles. So is the pumpkin
- The mouth is a polygon.
- Make the stars with a
for
loop and random numbers (for example use(int)(Math.random()*100)
to make a random number from 0-99). Randomize the location and the radius, but don’t put stars on the ground. - You should define some variables for the center point between the two eyes, and reuse that variable for all the eye shapes
Images
Here’s the image
And here’s a version with a 25 pixel grid.
And here’s a version with a 10 pixel grid.
Extensions
- Take user input for things like eye radius, distance between eyes, mouth size, etc. and vary the picture based on input.
- Define a ‘center’ variable and make the entire pumpkin a function of the center.
- Make a glow effect by drawing the eyes as a series of concentric circles that get smaller and slightly brighter.
- As in 2, define a ‘scale’ variable so changing the scale resizes the whole pumpkin.
- Animation!