From 09b4d54e66beb71eaa3b482e298e93d7be8f4d00 Mon Sep 17 00:00:00 2001 From: officereso Date: Sat, 18 May 2019 19:35:36 -0500 Subject: [PATCH] Changed car_sprit class to to player and moved it into package Sprites. added everything into a package Signed-off-by: officereso --- .idea/uiDesigner.xml | 124 ++++++++++++++++++ src/{ => project}/Background.java | 6 +- src/{ => project}/Expo.java | 110 ++++++++-------- src/{ => project}/Main.java | 4 + .../Sprites/player.java} | 7 +- 5 files changed, 192 insertions(+), 59 deletions(-) create mode 100644 .idea/uiDesigner.xml rename src/{ => project}/Background.java (53%) rename src/{ => project}/Expo.java (91%) rename src/{ => project}/Main.java (68%) rename src/{car_sprit.java => project/Sprites/player.java} (54%) diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Background.java b/src/project/Background.java similarity index 53% rename from src/Background.java rename to src/project/Background.java index 73d89a0..cc9e278 100644 --- a/src/Background.java +++ b/src/project/Background.java @@ -1,9 +1,11 @@ +package project; + import java.applet.Applet; import java.awt.*; public class Background extends Applet { - public static void draw(Graphics g){ - Expo.fillRoundedRectangle(g,10,10,300,500,6); + public static void create(Graphics g){ + Expo.fillRoundedRectangle(g,100,100,410,500,6); Expo.setColor(g,Expo.gray); } } diff --git a/src/Expo.java b/src/project/Expo.java similarity index 91% rename from src/Expo.java rename to src/project/Expo.java index ea5fad4..605abf6 100644 --- a/src/Expo.java +++ b/src/project/Expo.java @@ -1,4 +1,4 @@ -// THE EXPO CLASS FOR INTRO/CP COMPUTER SCIENCE +package project;// THE EXPO CLASS FOR INTRO/CP COMPUTER SCIENCE // NOTE: HTML
(breaks) are used in the documentation so it will look better in Javadoc. @@ -12,20 +12,20 @@ import java.applet.Applet; * * EXPO CLASS UPDATE: 11/14/2016

* - * The concept and implementation of the original set of Expo class methods was created by John L. M. Schram - * (the Son), who is called John Schram. The Expo class was created to teach programming skills to students - * in introductory computer science courses. Use of the Expo class eliminates many program steps that are + * The concept and implementation of the original set of project.Expo class methods was created by John L. M. Schram + * (the Son), who is called John Schram. The project.Expo class was created to teach programming skills to students + * in introductory computer science courses. Use of the project.Expo class eliminates many program steps that are * tedious and frustrating for beginning students. Program input is simplified and graphics commands are * more intuitive. Many additional graphics commands are added to allow for interesting displays with minimal effort. * - * The Expo class is a work in progress and you can expect the Schrams to add/remove methods from time to time. + * The project.Expo class is a work in progress and you can expect the Schrams to add/remove methods from time to time. * The version date will indicate if you have the latest update. * * This version of the EXPO class is meant for "Regular" or "CP" Computer Science. - * In addition to all of the methods from the Pre-APCS version of the Expo class, + * In addition to all of the methods from the Pre-APCS version of the project.Expo class, * this version also includes methods drawString, setFont, drawPolygon and fillPolygon. * - * Since the creation of the initial bulk of the Expo class, John L. A. Schram (the father), who is called + * Since the creation of the initial bulk of the project.Expo class, John L. A. Schram (the father), who is called * Leon Schram, has added some additional methods. Both John Schram and Leon Schram are computer science * teachers at John Paul II High School in Plano, Texas. * @@ -34,7 +34,7 @@ import java.applet.Applet; * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * - * 36 constant colors are built into the Expo class + * 36 constant colors are built into the project.Expo class * The 7 primary colors are red, green, blue, orange, yellow, tan and gray. * Each of these colors also has a "dark" shade and a "light" shade. * For example, the 3 shades of red are: red, lightRed and darkRed. @@ -131,7 +131,7 @@ public class Expo * Returns a "true" random integer in the [min..max] range, inclusive.
* Precondition: max > min
* Example:
- * System.out.println(Expo.random(100,200));
+ * System.out.println(project.Expo.random(100,200));
* This will display a random integer between 100 and 200. **/ public static int random(int min, int max) @@ -156,7 +156,7 @@ public class Expo /** * Pauses the output and waits for the user to press the [enter] key.
* Example:
- * Expo.pause(); + * project.Expo.pause(); **/ public static void pause() { @@ -170,12 +170,12 @@ public class Expo /** * Pauses the output for a specified number of milliseconds (1/1000ths of a second).
* Examples:
- * Expo.delay(1000); // pause for 1 second
- * Expo.delay(2000); // pause for 2 seconds
- * Expo.delay(500); // pause for 1/2 of a second
- * Expo.delay(100); // pause for 1/10 of a second
- * Expo.delay(10); // pause for 1/100 of a second
- * Expo.delay(1); // pause for 1/1000 of a second
+ * project.Expo.delay(1000); // pause for 1 second
+ * project.Expo.delay(2000); // pause for 2 seconds
+ * project.Expo.delay(500); // pause for 1/2 of a second
+ * project.Expo.delay(100); // pause for 1/10 of a second
+ * project.Expo.delay(10); // pause for 1/100 of a second
+ * project.Expo.delay(1); // pause for 1/1000 of a second
**/ public static void delay(int n) { @@ -198,7 +198,7 @@ public class Expo * Allows input of an int (integer) from the keyboard in a text window.
* Example:
* System.out.print("How old are you? --> ");
- * int age = Expo.enterInt(); + * int age = project.Expo.enterInt(); **/ public static int enterInt() { @@ -212,7 +212,7 @@ public class Expo * Allows input of a double (real number) from the keyboard in a text window.
* Example:
* System.out.print("What is your current GPA? {0.00 - 4.00} --> ");
- * double gpa = Expo.enterDouble(); + * double gpa = project.Expo.enterDouble(); **/ public static double enterDouble() { @@ -226,7 +226,7 @@ public class Expo * Allows input of a String from the keyboard in a text window.
* Example:
* System.out.print("What is your name? ---> ");
- * String name = Expo.enterString(); + * String name = project.Expo.enterString(); **/ public static String enterString() { @@ -240,7 +240,7 @@ public class Expo * Allows input of a char from the keyboard in a text window.
* Example:
* System.out.print("What is your middle initial? --> ");
- * char middleInitial = Expo.enterChar(); + * char middleInitial = project.Expo.enterChar(); **/ public static char enterChar() { @@ -262,9 +262,9 @@ public class Expo /** * Allows the user to change the color, using a Color object parameter.
* Example: - * Expo.setColor(g,Expo.red); + * project.Expo.setColor(g,project.Expo.red); * Changes the current drawing color to red. - * 36 colors constants are built into the Expo class. These colors are listed near the top of this file. + * 36 colors constants are built into the project.Expo class. These colors are listed near the top of this file. **/ public static void setColor(Graphics g, Color newColor) { @@ -288,7 +288,7 @@ public class Expo * 9 = pink
* Any negative number will give you white.

* Example:
- * Expo.setColor(g,1);
+ * project.Expo.setColor(g,1);
* Changes the current drawing color to red. **/ public static void setColor(Graphics g, int colorNum) @@ -316,7 +316,7 @@ public class Expo * This allows for more than 16 million different color combinations.
* Precondition: All 3 color values need to be between 0 and 255 inclusive.
* Example:
- * Expo.setColor(g,190,10,47);
+ * project.Expo.setColor(g,190,10,47);
* Changes the current drawing color to the shade of red used in the official Texas Flag **/ public static void setColor(Graphics g, int red, int green, int blue) @@ -335,7 +335,7 @@ public class Expo * Small alpha values are more transparent. Large alpha values are more opaque.
* Precondition: All 4 int values need to be between 0 and 255 inclusive.
* Example:
- * Expo.setColor(g,190,10,47,128);
+ * project.Expo.setColor(g,190,10,47,128);
* Changes the current drawing color to the shade of red used in the official Texas Flag * and makes it semi-transparent **/ @@ -350,7 +350,7 @@ public class Expo /** * Sets the current color to a random color value which can be any of the 16,000,000+ possible colors.
* Example:
- * Expo.setRandomColor(g); + * project.Expo.setRandomColor(g); **/ public static void setRandomColor(Graphics g) { @@ -368,9 +368,9 @@ public class Expo * Precondition: The applet window cannot be greater than 4800 X 3600 in size.
* Postcondition: The current drawing color will not be affected by the background color.
* Example:
- * Expo.setBackground(g,Expo.red); + * project.Expo.setBackground(g,project.Expo.red); * This will make the entire background red. - * 36 colors constants are built into the Expo class. These colors are listed near the top of this file. + * 36 colors constants are built into the project.Expo class. These colors are listed near the top of this file. **/ public static void setBackground(Graphics g, Color bgColor) { @@ -394,7 +394,7 @@ public class Expo * 9 = pink
* Any negative number will give you white.

* Example:
- * Expo.setBackground(g,1);
+ * project.Expo.setBackground(g,1);
* Changes the background color to red. **/ public static void setBackground(Graphics g, int colorNum) @@ -423,7 +423,7 @@ public class Expo * The applet window cannot be greater than 4800 X 3600 in size.
* Postcondition: The current drawing color will not be affected by the background color.
* Example:
- * Expo.setBackground(g,190,10,47);
+ * project.Expo.setBackground(g,190,10,47);
* Changes the background color to the shade of red used in the official Texas Flag **/ @@ -446,7 +446,7 @@ public class Expo /** * Draws a single pixel at the specified x,y location.
* Example:
- * Expo.drawPixel(g,100,200);
+ * project.Expo.drawPixel(g,100,200);
* Draws a very small single dot (pixel) on the computer screen 100 pixels over and 200 pixels down **/ public static void drawPixel(Graphics g, int x, int y) @@ -458,7 +458,7 @@ public class Expo /** * Draws a 3 pixel X 3 pixel "point" whose center is at the specified x,y location.
* Example:
- * Expo.drawPoint(g,100,200); + * project.Expo.drawPoint(g,100,200); * Draws a larger, more visible (than drawPixel) dot on the computer screen 100 pixels over and 200 pixels down. **/ public static void drawPoint(Graphics g, int x, int y) @@ -470,7 +470,7 @@ public class Expo /** * Draws the line segment connecting coordinates x1,y1 and x2,y2.
* Example:
- * Expo.drawLine(g,100,200,300,400);
+ * project.Expo.drawLine(g,100,200,300,400);
* Draws a line segment connecting the starting coordinate point (100,200) with the ending point (300,400). **/ public static void drawLine(Graphics g, int x1, int y1, int x2, int y2) @@ -481,7 +481,7 @@ public class Expo /** * Draws a thicker line segment connecting coordinates x1,y1 and x2,y2.
* Example:
- * Expo.drawLine(g,100,200,300,400);
+ * project.Expo.drawLine(g,100,200,300,400);
* Draws a line segment connecting the starting coordinate point (100,200) with the ending point (300,400). **/ public static void drawThickLine(Graphics g, int x1, int y1, int x2, int y2) @@ -495,7 +495,7 @@ public class Expo * Draws an open circle.
* The user specifies the x,y coordinate of the center of the circle as well as the radius value.
* Example:
- * Expo.drawCircle(g,300,200,100);
+ * project.Expo.drawCircle(g,300,200,100);
* Draws an open circle with a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void drawCircle(Graphics g, int centerX, int centerY, int radius) @@ -509,7 +509,7 @@ public class Expo * Draws an open oval.
* The user specifies the x,y coordinate of the center of the oval as well as the horizontal and vertical radii values.
* Example:
- * Expo.drawOval(g,300,200,100,50);
+ * project.Expo.drawOval(g,300,200,100,50);
* Draws an open oval with a horizontal radius of 100 pixels and a vertical radius of 50 pixels.
* The center of this oval is located at the coordinate (300,200). **/ @@ -547,7 +547,7 @@ public class Expo * Draws an open rectangle.
* The upper-left-hand corner is specified by x1,y1 and the lower-right-hand corner is specified by x2, y2.
* Example:
- * Expo.drawRectangle(g,100,200,300,400);
+ * project.Expo.drawRectangle(g,100,200,300,400);
* Draws an open rectangle whose upper-left-hand coordinate is (100,200) and whose lower-right-hand coordinate is (300,400). **/ public static void drawRectangle(Graphics g, int x1, int y1, int x2, int y2) @@ -568,7 +568,7 @@ public class Expo * The first 5 parameters (g and 4 ints) are the same as drawRect.
* The final parameter "pixels" specifies the number of pixels used in the rounded corner.
* Example:
- * Expo.drawRoundedRectangle(g,100,200,300,400,25); + * project.Expo.drawRoundedRectangle(g,100,200,300,400,25); **/ public static void drawRoundedRectangle(Graphics g, int x1, int y1, int x2, int y2, int pixels) { @@ -589,7 +589,7 @@ public class Expo * (It is actually the radius of the circle that the spiral would fit inside.)
* The spacing is controlled by the "spacing" parameter.
* Example:
- * Expo.drawSpiral(g,300,200,100,25);
+ * project.Expo.drawSpiral(g,300,200,100,25);
* Draws a spiral with a maxRadius of 100 pixels whose center is located at the coordinate (300,200).
* There are precisely 25 pixels separating each "loop" of the spiral.
**/ @@ -615,7 +615,7 @@ public class Expo * The lines are evenly spaced and drawn from the center of a circle to its edge.
* The size of the circle is specified by the radius parameter.
* Example:
- * Expo.drawBurst(g,300,200,100,50);
+ * project.Expo.drawBurst(g,300,200,100,50);
* Draws a "burst" with a radius of 100 pixels whose center is located at the coordinate (300,200).
* The "burst" will be comprised of 50 evenly spaced lines. **/ @@ -642,7 +642,7 @@ public class Expo * (As in the radius of the circle the regular polygon would fit inside).
* Precondition: sides >= 3
* Example: - * Expo.drawRegularPolygon(g,300,200,100,8); + * project.Expo.drawRegularPolygon(g,300,200,100,8); * Draws an open regular octagon with a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void drawRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides) @@ -673,7 +673,7 @@ public class Expo * (As in the radius of the circle the star would fit inside).
* Precondition: points >= 2
* Example:
- * Expo.drawStar(g,300,200,100,8);
+ * project.Expo.drawStar(g,300,200,100,8);
* Draws an open star with 8 points and a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void drawStar(Graphics g, int centerX, int centerY, int radius, int points) @@ -715,7 +715,7 @@ public class Expo * Displays a heading at the top of the graphics screen.
* The user provides his/her name and the number of the lab assignment.
* Example:
- * Expo.drawHeading(g,"John Smith","6B");
+ * project.Expo.drawHeading(g,"John Smith","6B");
* Displays "Lab 6B By: John Smith" centered at the top of the graphics screen in big bold letters.
* A separating line will also be drawn across the graphics screen 50 pixels below the top. **/ @@ -744,7 +744,7 @@ public class Expo * Draws a solid "filled in" circle.
* The user specifies the x,y coordinate of the center of the circle as well as the radius value.
* Example:
- * Expo.fillCircle(g,300,200,100);
+ * project.Expo.fillCircle(g,300,200,100);
* Draws a solid circle with a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void fillCircle(Graphics g, int centerX, int centerY, int radius) @@ -758,7 +758,7 @@ public class Expo * Draws a solid "filled in" oval.
* The user specifies the x,y coordinate of the center of the oval as well as the horizontal and vertical radii values.
* Example:
- * Expo.fillOval(g,300,200,100,50);
+ * project.Expo.fillOval(g,300,200,100,50);
* Draws a solid oval with a horizontal radius of 100 pixels and a vertical radius of 50 pixels.
* The center of this oval is located at the coordinate (300,200). **/ @@ -796,7 +796,7 @@ public class Expo * Draws a solid "filled in" rectangle.
* The upper-left-hand corner is specified by x1,y1 and the lower-right-hand corner is specified by x2, y2.
* Example:
- * Expo.fillRectangle(g,100,200,300,400);
+ * project.Expo.fillRectangle(g,100,200,300,400);
* Draws an open rectangle whose upper-left-hand coordinate is (100,200) and whose lower-right-hand coordinate is (300,400). **/ public static void fillRectangle(Graphics g, int x1, int y1, int x2, int y2) @@ -834,7 +834,7 @@ public class Expo * (As in the radius of the circle the regular polygon would fit inside).
* Precondition: sides >= 3
* Example: - * Expo.fillRegularPolygon(g,300,200,100,8); + * project.Expo.fillRegularPolygon(g,300,200,100,8); * Draws a solid "filled-in" regular octagon with a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void fillRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides) @@ -893,7 +893,7 @@ public class Expo * (As in the radius of the circle the star would fit inside).
* Precondition: points >= 2
* Example:
- * Expo.fillStar(g,300,200,100,8);
+ * project.Expo.fillStar(g,300,200,100,8);
* Draws a solid star with 8 points and a radius of 100 pixels whose center is located at the coordinate (300,200). **/ public static void fillStar(Graphics g, int centerX, int centerY, int radius, int points) @@ -936,7 +936,7 @@ public class Expo ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Methods not included in the Pre-APCS version of the Expo class: + // Methods not included in the Pre-APCS version of the project.Expo class: ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -944,7 +944,7 @@ public class Expo * Draws a String s on the graphics screen at a certain x,y coordinate.
* The coordinate x,y is the location of the bottom-left corner of the first character in the String s.
* Example:
- * Expo.drawString(g,"Hello There!",100,200); + * project.Expo.drawString(g,"Hello There!",100,200); **/ public static void drawString(Graphics g, String s, int x, int y) { @@ -955,7 +955,7 @@ public class Expo /** * Allows you to change the current "font" used by the drawString method.
* Example:
- * Expo.setFont(g,"Courier",Font.BOLD,36); + * project.Expo.setFont(g,"Courier",Font.BOLD,36); **/ public static void setFont(Graphics g, String name, int style, int size) { @@ -967,8 +967,8 @@ public class Expo /** * Draws an open irregular polygon using 3 or more sets of provided coordinates.
* Examples:
- * Expo.drawPolygon(g,100,300,200,100,300,300); // for a triangle - * Expo.drawPolygon(g,525,300,600,250,650,250,725,300,725,350,650,400); // for a hexagon + * project.Expo.drawPolygon(g,100,300,200,100,300,300); // for a triangle + * project.Expo.drawPolygon(g,525,300,600,250,650,250,725,300,725,350,650,400); // for a hexagon **/ public static void drawPolygon(Graphics g, int... coordinate) { @@ -997,8 +997,8 @@ public class Expo /** * Draws an solid "filled-in" irregular polygon using 3 or more sets of provided coordinates.
* Examples:
- * Expo.fillPolygon(g,100,300,200,100,300,300); // for a triangle - * Expo.fillPolygon(g,525,300,600,250,650,250,725,300,725,350,650,400); // for a hexagon + * project.Expo.fillPolygon(g,100,300,200,100,300,300); // for a triangle + * project.Expo.fillPolygon(g,525,300,600,250,650,250,725,300,725,350,650,400); // for a hexagon **/ public static void fillPolygon(Graphics g, int... coordinate) { diff --git a/src/Main.java b/src/project/Main.java similarity index 68% rename from src/Main.java rename to src/project/Main.java index daee4d5..55b91de 100644 --- a/src/Main.java +++ b/src/project/Main.java @@ -1,8 +1,12 @@ +package project; + import java.applet.Applet; import java.awt.*; public class Main extends Applet { public void paint(Graphics g){ Expo.drawHeading(g,"Quentin Snow and Alekkai","Final Project"); + Background.create(g); + // project.Sprites.player.make(g); } } diff --git a/src/car_sprit.java b/src/project/Sprites/player.java similarity index 54% rename from src/car_sprit.java rename to src/project/Sprites/player.java index 953d0b7..f2100c9 100644 --- a/src/car_sprit.java +++ b/src/project/Sprites/player.java @@ -1,8 +1,11 @@ +package project.Sprites; + +import project.Expo; import java.applet.Applet; import java.awt.*; -public class car_sprit extends Applet { - public void paint(Graphics g){ +public class player extends Applet { + public static void make(Graphics g){ Expo.fillRectangle(g,100,100,125,150); Expo.fillRectangle(g,105,110,95,120); }