Unit 7 ProjectThis is a program grade. YOU MUST DO ALL WORK ON YOUR OWN!1. There are possible grades of 70, 80, 85, 95, 100 and 105. 2. If I grade it for a 70, 75, or 85, then you are finished because I will not grade it again. 3. If you go for 95 or more, I will grade it a second time if you are going for a higher grade. 4. Here are some samples: Samples - I used a bug for all the samples. This window will stay open if you want to refer back to it. 5. We are going to make a race. You may use the methods that you developed in Lab7d3-Lab7d5 i.e. tank, bug, man or truck or come up with another idea. You must change each method and make it your own or create your own "character"
To start 1. Create a new Applet for your Unit 7 folder with your firstname and classperiod - just like before - Laura2 or Michael5, etc . NO mistakes this time! - -5 points for bad names. 2. Set up the size window you want - no larger than 800 by 500. Most will use something like 500 by 250. Give it a background color. | ||||||||||
|
3.Open two versions of JCreater and copy everything in the java file (which ever one you chose--bug, blueman, truck, or tank), paste into your new program and change the class name. 4. Each object ( like a bug) will need his own
variable. For example I race Bug1 at k, 100 and Bug2 at j,
200.
Don't forget the wrapping code or stopping code for j. If all the extra files are closed, try compiling and running it now. Fix all the compiling errors. You should have 2 objects rolling across the screen together. If you have run out of time and it is the last day, I will grade this for a 50 ( better than a zero! ) | ||||||||||
|
5. We are now going to make the objects move at different rates. To do this we need random numbers. These were introduced in Lab3e and have appeared several times since then.
Compile and try program - the objects should not run together anymore. | ||||||||||
|
6. Now it is time to add some background scene. Minimum acceptable is a finish time and race track line(s). I used a for loop for the dotted line ( with no delay). Add a title now if you want to. You may want to move everything down so you can add a title. Use fonts and drawString to name your objects. If you want to race 3 objects ( max allowed) add it now, with all the parts It isn't that difficult to change the objects later so like you have a blue man and a green man racing or to change Bug colors or tank colors. Just a lot of copy and paste. | ||||||||||
|
7. Now we need both objects to stop like we did in Lab7d3 for one object. You have to have a finish line, before you do this step. Everyone's will be a little different. You have to work with your game, not your neighbors. My Line has a horizontal value of 300 so I will use 300 in all discussion of a finish line. FIRST - If
your objects wrap, this must be deleted. Find the conditional for k and j,
and REMOVE the code for k and j that looks like
this. We do not want the objects to wrap. DO NOT REMOVE the incrementer. You have to protect the incremeters k+= stuff and j+= stuff. The problem is
that they can only run if you have not reached the end. This can be done
using a boolean and && If there is blinking,
check for extra repaints or delays. Only one of each is needed at this
time. Your code will look something like this - don't just copy and paste.
This is the 70. Stop here if you are running out of time. If you have buttons that don't work , hide them. This step is temporary - we have many changes to make for a better grade. | ||||||||||
|
8. For the 80, you need Button code that works They should appear and not get in the way of any other part of the applet. If you want to, you can add a borderLayout and a panel. the buttons can be on the top, bottom, or left side if you wish You will need to try things to make it work. Read the pseudo code here to guide you. The major problem is you need the if(motion.equals("go" ) BEFORE the set of nested if....elses and the finish line part see how I did this:
Compile, Clean up any compiling errors. the start button should work but not the restart Button The next place to work is inside the actionPerformed method. Try this:
Inside the b2
conditional, I will grade this for a 80 if it works perfectly and looks good - color, fonts - down to 75 for really sloppy work. You have one opportunity to fix it. Don't ask me to grade unless you are stopping here and this is the highest grade you have time for. You are the best judge of your time and abilities. | ||||||||||
|
9. To get a
85 on this project, add code to say who wins - this is
very simple - we did this in Lab3e put it where you see // *1 if( k > j) Be sure to use colors, fonts, drawStrings to write the information on the screen. Call me to grade at this time if it runs correctly - one free grade - best grade 95, sloppy appearance, as low as 90. | ||||||||||
|
10. For 95, you need 2 additional integers to act as counters/incriminators of Bug1's wins and Bug2's wins. Last time we used counters was in Lab4c2 where we added money for wins and it was discussed in the pink section of Lab3e where we counting how many were correct. Be sure to declare the integers in the global variable section and set them equal to zero. 11. For 100, Get the message with the number of each wins to stay on the screen. this means you have to move things around. It does not mean adding new code. 12. For 105, add a reset Button to reset the scores back to zero. This can be done after the grade of 100 for a grade of 105. You are on your own here. |