Use object-based design and define the following additional classes:
class Monkey {
...
}
class Flock {
...
}
class Button {
...
}
Waving grass:
At the bottom of the screen, draw some waving grass
(evenly-spaced lines)
that leans to the left or right
following the direction of motion for one of the creatures
(hero, monster, sun, etc.)
bird
bird
bird
bird
bird
bird
bird
|
Flock of birds:
A flock of birds flies across the screen in "Vee" formation
(each each pair of birds is slightly smaller than the ones ahead,
following behind and farther apart,
one higher and one lower).
When the flock reaches right side of the screen,
change height to a random value,
and change the number of (pairs of) birds to a random number.
OPTIONAL ANIMATION (for extra credit):
As they fly, each bird
flaps its wing up or down, every second or so (30 frames).
| |
|______|
| |
| |
| |
|_____%|
| , / |
| ## |
| ## |
|_/__;_|
|% |
| |
| |
|______|
| |
|
Ladder with climbing monkey.
Add a vertical ladder,
somewhere on the screen,
with a "monkey" that can climb the ladder,
upward or downward.
When the "u" (or "d") key is clicked,
have the monkey go UP (or DOWN) one step of the ladder,
and change position of hands and feet
(to provide a two-step animation).
In one position,
the monkey's right hand is reaching up and left leg is reaching down;
reverse these positions for the next step.
Add some buttons to control the action.
Add an "UP" button and a "DOWN" button.
When clicked, these buttons do the same thing as
pressing the "u" or "d" key.
Add at least three more buttons,
such as "QUIT" or "RESET"
to do something to the screen, when clicked.
EXAMPLES
The following code illustrates some of the above features:
mauricio.java
.
(However, this code is not entirely object-oriented,
and it has several additional features that are not required.
You may use this and other codes to get ideas,
but do not copy any lines of code
and make sure you understand
every line of code you submit as your own!)
NOTES:
COMPLETION & GRADING:
- It is NOT
necessary to meet ALL
of the requirements, to complete this project.
- If you do MOST
of them,
and do them well,
then projects 1, 2, and 3 will be marked as "completed".
- Requirements are somewhat flexible,
and you may change the details such as scoring,
behavior of creatures,
colors, shapes, scenery, etc.
- The main purpose of these projects
if for you to demonstrate skills in using the various Java language features
(such as loops, if/else, functions, arguments, etc.),
as well as good software practices
(such as readability, modularity, meaningful names, commenting, etc.)
CODING STANDARDS & READABILITY :
Code that does not compile is unacceptable and will not be graded.
Make sure that the code you submit compiles and runs in the Processing PDE.
Another important aspect of computer programming is the "readability" of your code.
- Code should be modularized, with separate functions ("methods") used for separate tasks,
- Each function should begin with a simple comment that says what it is supposed to do.
- Use meaningful names for variables and functions,
- Avoid global declarations where possible.
- Use object-based design.
Below is an excerpt from the
course outline.
-
CODING STANDARDS :
-
This is a course in computer progamming,
i.e. the development of software "code"
that has two audiences:
- computers, which must compile and execute the code, and
- human programmers, who must read and understand the code
(e.g. in order to debug or modify it).
Therefore,
good programming practice
depends not only upon how the computer processes the code,
but also upon the ability of other programmers to read and understand the code
(perhaps in order to debug or modify it).
For coding assignments,
grading will be based not only on
whether the code compiles correctly and performs the assigned tasks,
but also upon
its organization, clarity,
and -- most of all -- "readability".
These and other aspects of
programming practices,
as well as adherance to
"coding standards"
(to ensure testability, maintainability, etc.)
will be introduced and discussed in the textbook and in class.
|
"Any fool can write code that a computer can understand.
Good programmers write code that humans can understand."
|
|
|