Proj Mouse in the House game (to
be name:MouseInTheHouse)
Using your code from HWJ14, make the famous MouseInTheHouse game.
The idea is to keep the user to keep the mouse in the circle as
much as possible in twenty seconds. You will need to know about
time.
See the rubric for the requirements (at the bottom)
Notes:
- implement MouseMotionListener
(that entails: mouseDragged and mouseMoved and add to init
- global variables
- int good; //keeping track of how many times you are in circle
- int missed; //keep track of how many times you missed
- int mouseX;
- int mouseY;
- original time (see time)
Some code:
int x=(int)(Math.random()*300+100); //give
a value between 100-400
int y=(int)(Math.random()*300+100); //give a value between 100-400
//This method will get a value of 5 or -5 for changeX and changeY
public void setRandomChanges()
{
if (Math.random()<.5) //this happens half the time
changeX=5;
else
changeX=-5;
if (Math.random()<.5) //this happens half the time
changeY=5;
else
changeY=-5;
}
Extensions: (for those of you looking to improve
the project)
RUBRIC:
This is worth 12 points
- Comments appropriately 2 points
- Variable names, methods appropriately 1 point
- Ball moves correctly (bounces off wall and moves randomly originally)
1 point
- Mouse action 2 points
- color changes when mouse inside object 1 point
- detects correctly if inside object - 1
- Reset works 2 points
- ball is reset -1
- score is reset -1
- Score works- 2 points
- good and bad calculated correctly -1
- percent calculated correctly -1
- Time works 2 points
- shows correctly -1
- stops at 20 - 1
|