Just wandering if you could help me out.
I have to write an applet that allows the user to select from either a
square or circle, either of which could be red,green or blue. The user
then has to predict how many times thee object will bounce off the sides
of the frame. Every time the object hits the side the prediction they said
is decremented by 1. I have no real idea how to do this.
08-20-2002, 08:37 AM
bgriggs
I don't know all the answers but I do know that you will need to implement the following things.
1. a mouse Listener, also probably a MouseMotionListener interface.
2. an collision detection scheme. This would test if two bojects are touching. This is usually done using bounding rectangles.
3. You need a bounding rectangle to represent each wall of the screen. Test for collision with these and your shapes.
4. When you use a mouse listener you must implement each method that make up a mouse listener. Example
mouseClicked(MouseEvent e) {}
//all the following have
//MouseEvent e inside ()