We explored how to draw and create our own images in class, and now you will be able to do it on your own.
If you don't remember how to do any of the steps (like, copying, zipping, etc), please refer back to Lab 1.
First, you will need to copy over the scenario for this assignment. If you are working from home, you can download the scenario here. If you are in lab, the scenario is located in /eng/class/notes/cse113/Lab9.
The background for the world at this point is pure white. You need to design a background for the world that is generated when world is created. Fill in the paintImage method in the ImageWorld class to create your background image. Create whatever image you'd like for the background, but make sure that at least one element of the background image is random. What is random is up to you, but you want to make something random to help you determine that the next step in the assignment is working.
In the image, you need to do more than simply fill the background with a color. There should be at least one shape (filled or outline) and at least two colors (one fill color and one color for shapes). However, you are free to have as many of these as you'd like.
Fill in the act method of the ImageWorld so that at random times throughout the running of the scenario, the background repaints. The frequency of this is up to you, but the less often this happens, the less distracting it is to watch over long periods of time. However, when you first start, you may want to make it occur more frequently so that you can make sure it is working.
Create an actor named Grower that when placed into the world, will start out at some size and grow to another size. When it reaches its maximum size, it should disappear. These sizes can be fixed or they can be random and set upon creation of the grower. The actor can be drawn (like a circle or square), or it can use an image file and scale it to be larger.
For now, manually add one or more to the world to test that they work correctly. They will actually be added to the world randomly in the finished program.
Create an actor named Shrinker that when placed into the world, will start out at some size and shrink to another size. When it reaches its minimum size, it should disappear. These sizes can be fixed or they can be random and set upon creation of the shrinker. The actor can be drawn (like a circle or square), or it can use an image file and scale it to be smaller.
For now, manually add one or more to the world to test that they work correctly. They will actually be added to the world randomly in the finished program.
Create an actor named GrowShrink that when placed into the world, will start out at some size and grow to another size. When it reaches its maximum size, it should begin to shrink to its minimum size. These sizes can be fixed or they can be random and set upon creation of the grower/shrinker. The actor can be drawn (like a circle or square), or it can use an image file and scale it to be smaller and larger. These actors will not leave the world.
Write code in the ImageWorld so that a random number of GrowShrink Actors appear in the world at random locations when the world is created.
Modify the GrowShrink actor so that it keeps track of how many times it has reached its maximum size. Every five times it reaches its maximum size, a random number of Grower actors (between 1 and 5) should appear in the world at random locations.
Modify the GrowShrink actor so that it keeps track of how many times it has reached its minimum size. Every ten times it reaches its minimum size, a random number of Shrinker actors (between 1 and 5) should appear in the world at random locations.
Create an actor named Fader that when placed into the world, will start out fully visible and will eventually fade away (the transparency will become so high that you will be able to see right through it). Note the setTransparency method in the GreenfootImage class. Passing in the value 0 will make the image completely transparent (invisible) and passing in the value 255 will make the image completely opaque (the default). The image should start out with transparency 255 and when it reaches zero, it should disappear. The actor can be drawn (like a circle or square), or it can use an image file.
For now, manually add one or more to the world to test that they work correctly. They will actually be added to the world when the user clicks the mouse in the finished program.
Write the code in the act method of the world that will add a Fader actor to the spot where the user clicks with the mouse. That is, every time the user clicks on the world with the mouse, a Fader will appear in that spot and begin fading away.
Once you have completed your work, you will submit the zipped up version of the Lab 9 scenario.
For directions on submitting, please see here.
Please recall that you must achieve a grade of at least 50% on each of the labs to be allowed to take the third practical exam. This lab is technically due on Monday, May 2nd at 11:59:59pm. However, if you want to stay current with the course, I would recommend having this assignment completed within a week. You will need mastery of the skills you learn in this lab to be successful at practical exam 3.
Please make sure to look at your grading information on Web-CAT. See the grading information page for more details about how to interpret Web-CAT grade reports. (Currently, the grading is not enabled for this assignment.)
The following tests were run on your assignment submission. Each test was given equal weight (10 points each).
Lab authored by Adrienne Decker