Assignment
5 Code
Due
date: Friday 5/7/04 by 4:00pm
Hand
in electronic copies: All the Java files that you
wrote, and questions.txt
Hand
in printed copies: All the Java files that you
wrote
Notes
and hints:
·
One
of the sections on the website is a suggested set of steps for incremental
development. This is such good advice
that it’s worth repeating it here, for easy reference:
o
Try
getting your maze to draw first. Just get all the walls, pellets, etc. in place
first so your background for the game is set.
o
Next
you may want to try to get the KeyListener set up. Use print statements at
first, just to be sure things are responding correctly to the keys you hit.
o
Next
get the TimerListener set up. Start the “phantoms moving” timer, and print
something when your code hears a timer tick. (Then take out all these print
statements, because they’re annoying.)
o
Next
you may want to try to get the JavaMuncher to move. Don't worry about walls and
food pellets yet, just basic up, down, left right movement.
o
Now
try to get the JavaMuncher to stay in bounds and off walls.
o
Now
get the JavaMuncher to eat food pellets
o
Next
try to get the phantoms to draw, stationary.
o
Get
the phantoms to move with the timer.
o
Then
get the phantoms about in the tunnels and then try to enable the eating of
phantoms and the losing of lives.
·
The
labs will get very crowded near the end of the term. If you want to have any real hope of getting help from
consultants, you’d better get it before the last few days.
·
Partners
should turn in one printed copy of the code, but both should submit the same
code electronically, so that we have it in our records for both of you.
·
To
get your maze to draw: use the JavaMuncherUtils methods to set the board
dimensions and add images. As the game progresses, use other methods to change
and move images.
·
Be
clear on what events cause what to happen: the muncher moves upon key presses,
the phantoms move upon one kind of timer event, the phantoms become eatable
when the muncher eats a power pellet, and they stop being eatable upon another
kind of timer event. In order for these
timer events to occur, you have to call methods to start the timers at the
right times (the first kind at the beginning of the game, the second kind when
the muncher eats a power pellet).
·
You’re
probably storing the board under the pretense that each thing on the board
takes up only one (x,y) location—that is, only one pixel. Remember that when
you actually draw these things, you’ll have to multiply each location by the
image size in both dimensions (all images have the same size) to make room for
a whole image.