Lab 10 - The Student Game
What will you learn
- Combined use of Timer and the tracking of user interactions
app.java, myJFrame.java, myJPanel.java, and other necessary Java files
The objective of the lab is to create a game in which the player has to click on a moving student-button to score.
1. The student button has to move constantly (using the timer)
2. The application has to keep the score
3. The actual score has to be shown.
4. Implement at least one of the extras listed below (#3 to #7)
- level of difficulty: High
- level of usefulness for the final project: Very High
I am giving you
- the timer example
- the new hybrid student-button (use yours from Lab 09)
- the mouse motion and mouse click examples
- the null layout example
Suggestion: start with the basic timer Java example and made the necessary changes to it.
#1 get the student button moving
you need the get timer started
you need a null layout (check the layout Java examples)
you need to set a different position for the button every time the timer ticks
#2 keep the score (on a separate button)
when these two are working, then:
#3 changes the image of the student button when it is clicked
when #3 is implemented, then:
#4 add a slider to make the button move faster or slower
- you need to use the setDelay() method applied to the timer.
when #4 is implemented, then:
#5 makes the movement smooth instead of jumping from one place to another place very far away.
#6 makes the student-button run faster when the mouse approaches it
when #5 and 6 are implemented, then
#7 whatever else you want to add to it
These are example files.
First three files are for mouse click.
Next three are for mouse motion.
Three after that are for Advanced Timer.
Three after that are for Basic Timer.
Next three are for Multi-timer.
Last 8 files are for the Null Layout.
- This Solution has been Purchased 5 time
- Average Rating for this solution is A+
- Submitted On 08 Nov, 2014 09:26:14
This tutorial is rat...