Java – Topic
29
(KeyListener)
TASK
QUESTION
I will only need the final copy
of this work which will be continued in the next lesson. However, I highly suggest that you save your
work as you go.
PART 1
Create an applet that is 500 by 500 (size is changed in the html document). Make a shooting visor (see below) move with the arrow keys.
The visor should also turn red when the space bar is down
and turn back to black when the space bar is released.
PART 2
Make it so your visor cannot move off screen. Therefore, its x and y coordinates are always between 0 and 500.