Cleaned code

Signed-off-by: officereso <qrs01@snowtx.com>
This commit is contained in:
officereso 2019-05-24 18:38:59 -05:00
parent be3b16cd7b
commit a96a7dec98
12 changed files with 41 additions and 136 deletions

View File

@ -7,8 +7,6 @@ import java.awt.*;
public class Colors { public class Colors {
static final Color roadGrey = new Color(68,68,68); static final Color roadGrey = new Color(68,68,68);
static final Color lineWhite = new Color(235, 235, 235); static final Color lineWhite = new Color(235, 235, 235);
static final Color lineYellow = new Color(218, 190, 93);
static final Color startGreen = new Color(13, 255, 0);
static final Color startBlue = new Color(112, 113, 255); static final Color startBlue = new Color(112, 113, 255);
static final Color red = new Color(255, 6, 0); static final Color red = new Color(255, 6, 0);
static final Color endGreen = new Color(150, 255, 0); static final Color endGreen = new Color(150, 255, 0);

View File

@ -1,5 +1,3 @@
// This module was created by Quentin Snow
package project; package project;
import java.applet.Applet; import java.applet.Applet;

View File

@ -5,8 +5,7 @@ package project;// THE EXPO CLASS FOR INTRO/CP COMPUTER SCIENCE
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.Scanner;
import java.applet.Applet;
/** /**
* *
@ -307,7 +306,7 @@ public class Expo
case 8 : g.setColor(gray); currentColor = gray; break; case 8 : g.setColor(gray); currentColor = gray; break;
case 9 : g.setColor(pink); currentColor = pink; break; case 9 : g.setColor(pink); currentColor = pink; break;
default : g.setColor(white); default : g.setColor(white);
}; }
} }
@ -647,8 +646,8 @@ public class Expo
**/ **/
public static void drawRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides) public static void drawRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides)
{ {
int xCoord[] = new int[sides]; int[] xCoord = new int[sides];
int yCoord[] = new int[sides]; int[] yCoord = new int[sides];
double rotate; double rotate;
if (sides % 2 == 1) if (sides % 2 == 1)
@ -682,8 +681,8 @@ public class Expo
int p = points; int p = points;
points *= 2; points *= 2;
int xCoord[] = new int[points]; int[] xCoord = new int[points];
int yCoord[] = new int[points]; int[] yCoord = new int[points];
int currentRadius; int currentRadius;
@ -839,8 +838,8 @@ public class Expo
**/ **/
public static void fillRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides) public static void fillRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides)
{ {
int xCoord[] = new int[sides]; int[] xCoord = new int[sides];
int yCoord[] = new int[sides]; int[] yCoord = new int[sides];
double rotate; double rotate;
if (sides % 2 == 1) if (sides % 2 == 1)
@ -902,8 +901,8 @@ public class Expo
int p = points; int p = points;
points *= 2; points *= 2;
int xCoord[] = new int[points]; int[] xCoord = new int[points];
int yCoord[] = new int[points]; int[] yCoord = new int[points];
int currentRadius; int currentRadius;

View File

@ -12,7 +12,6 @@ public class Main extends Applet {
private Rectangle lBtn = new Rectangle(480,220,120,80); private Rectangle lBtn = new Rectangle(480,220,120,80);
private Rectangle rBtn = new Rectangle(630,220,120,80); private Rectangle rBtn = new Rectangle(630,220,120,80);
private static int Px = 150; private static int Px = 150;
private static boolean btnException = true;
private static boolean spwNpc1, spwNpc2 = true; private static boolean spwNpc1, spwNpc2 = true;
public void paint(Graphics g){ public void paint(Graphics g){
@ -50,7 +49,6 @@ public class Main extends Applet {
public boolean mouseDown(Event e, int x, int y){ public boolean mouseDown(Event e, int x, int y){
btnException = true;
if (startBtn.inside(x,y)){ if (startBtn.inside(x,y)){
start = true; start = true;
} }
@ -60,8 +58,6 @@ public class Main extends Applet {
if (rBtn.inside(x,y)){ if (rBtn.inside(x,y)){
Px+=10; Px+=10;
} }
btnException = false;
repaint(); repaint();
System.out.println(x+" "+y); System.out.println(x+" "+y);
return true; return true;

View File

@ -1,37 +1,32 @@
package project.Sprites; package project.Sprites;
import project.Colors;
import project.Expo; import project.Expo;
import java.applet.Applet; import java.applet.Applet;
import java.awt.*; import java.awt.*;
public class NPC extends Thread { public class NPC extends Applet {
public NPC(Graphics g) { public NPC(Graphics g) {
int x = Expo.random(100, 400); int x = Expo.random(100, 400);
Expo.setColor(g,colorsTemp.NPC1Body); Expo.setColor(g, SpriteColors.NPC1Body);
Expo.fillRectangle(g, x, 110, x + 35, 170); Expo.fillRectangle(g, x, 110, x + 35, 170);
Expo.setColor(g,colorsTemp.Tires); Expo.setColor(g, SpriteColors.Tires);
Expo.fillRectangle(g, x + 5, 118, x - 5, 138); Expo.fillRectangle(g, x + 5, 118, x - 5, 138);
Expo.fillRectangle(g, x + 5, 145, x - 5, 165); Expo.fillRectangle(g, x + 5, 145, x - 5, 165);
Expo.fillRectangle(g, x + 30, 118, x + 40, 138); Expo.fillRectangle(g, x + 30, 118, x + 40, 138);
Expo.fillRectangle(g, x + 30, 145, x + 40, 165); Expo.fillRectangle(g, x + 30, 145, x + 40, 165);
} }
}
/*
public static void make(Graphics g){ public static void make(Graphics g){
int x = Expo.random(100,400); int x = Expo.random(100,400);
Expo.setColor(g,colorsTemp.NPC1Body); Expo.setColor(g,SpriteColors.NPC1Body);
Expo.fillRectangle(g, x, 110, x+35, 170); Expo.fillRectangle(g, x, 110, x+35, 170);
Expo.setColor(g,colorsTemp.Tires); Expo.setColor(g,SpriteColors.Tires);
Expo.fillRectangle(g, x+5, 118, x-5, 138); Expo.fillRectangle(g, x+5, 118, x-5, 138);
Expo.fillRectangle(g, x+5, 145, x-5, 165); Expo.fillRectangle(g, x+5, 145, x-5, 165);
Expo.fillRectangle(g, x+30, 118, x+40, 138); Expo.fillRectangle(g, x+30, 118, x+40, 138);
Expo.fillRectangle(g, x+30, 145, x+40, 165); Expo.fillRectangle(g, x+30, 145, x+40, 165);
} }
} }*/
// Expo.setColor(g,colorsTemp.NPC1Body);
// Expo.fillRectangle(g, 100, 100, 135, 160);
// Expo.setColor(g,colorsTemp.Tires);
// Expo.fillRectangle(g, 105, 108, 95, 128);
// Expo.fillRectangle(g, 105, 135, 95, 155);
// Expo.fillRectangle(g, 130, 108, 140, 128);
// Expo.fillRectangle(g, 130, 135, 140, 155);

View File

@ -1,18 +0,0 @@
package project.Sprites;
import project.Colors;
import project.Expo;
import java.applet.Applet;
import java.awt.*;
public class NPC2 extends Applet {
public static void make(Graphics g) {
Expo.setColor(g,colorsTemp.NPC2Body);
Expo.fillRectangle(g, 100, 100, 135, 160);
Expo.setColor(g,colorsTemp.Tires);
Expo.fillRectangle(g, 105, 108, 95, 128);
Expo.fillRectangle(g, 105, 135, 95, 155);
Expo.fillRectangle(g, 130, 108, 140, 128);
Expo.fillRectangle(g, 130, 135, 140, 155);
}
}

View File

@ -1,18 +0,0 @@
package project.Sprites;
import project.Colors;
import project.Expo;
import java.applet.Applet;
import java.awt.*;
public class NPC3 extends Applet {
public static void make(Graphics g) {
Expo.setColor(g,colorsTemp.NPC3Body);
Expo.fillRectangle(g, 100, 100, 135, 160);
Expo.setColor(g,colorsTemp.Tires);
Expo.fillRectangle(g, 105, 108, 95, 128);
Expo.fillRectangle(g, 105, 135, 95, 155);
Expo.fillRectangle(g, 130, 108, 140, 128);
Expo.fillRectangle(g, 130, 135, 140, 155);
}
}

View File

@ -1,18 +0,0 @@
package project.Sprites;
import project.Colors;
import project.Expo;
import java.applet.Applet;
import java.awt.*;
public class NPC4 extends Applet {
public static void make(Graphics g) {
Expo.setColor(g,colorsTemp.NPC4Body);
Expo.fillRectangle(g, 100, 100, 135, 160);
Expo.setColor(g,colorsTemp.Tires);
Expo.fillRectangle(g, 105, 108, 95, 128);
Expo.fillRectangle(g, 105, 135, 95, 155);
Expo.fillRectangle(g, 130, 108, 140, 128);
Expo.fillRectangle(g, 130, 135, 140, 155);
}
}

View File

@ -1,18 +0,0 @@
package project.Sprites;
import project.Colors;
import project.Expo;
import java.applet.Applet;
import java.awt.*;
public class NPC5 extends Applet {
public static void make(Graphics g) {
Expo.setColor(g,colorsTemp.NPC5Body);
Expo.fillRectangle(g, 100, 100, 135, 160);
Expo.setColor(g,colorsTemp.Tires);
Expo.fillRectangle(g, 105, 108, 95, 128);
Expo.fillRectangle(g, 105, 135, 95, 155);
Expo.fillRectangle(g, 130, 108, 140, 128);
Expo.fillRectangle(g, 130, 135, 140, 155);
}
}

View File

@ -0,0 +1,9 @@
package project.Sprites;
import java.awt.*;
public class SpriteColors {
static final Color playerBody = new Color(247, 17, 17);
static final Color Tires = new Color(0, 0, 0);
static final Color NPC1Body = new Color(0, 247, 0);
}

View File

@ -1,18 +0,0 @@
package project.Sprites;
import java.awt.*;
public class colorsTemp {
static final Color roadGrey = new Color(68,68,68);
static final Color lineWhite = new Color(235, 235, 235);
static final Color lineYellow = new Color(218, 190, 93);
static final Color startGreen = new Color(13, 255, 0);
static final Color startBlue = new Color(112, 113, 255);
static final Color playerBody = new Color(247, 17, 17);
static final Color Tires = new Color(0, 0, 0);
static final Color NPC1Body = new Color(0, 247, 0);
static final Color NPC2Body = new Color(221, 247, 0);
static final Color NPC3Body = new Color(247, 113, 0);
static final Color NPC4Body = new Color(0, 11, 247);
static final Color NPC5Body = new Color(247, 0, 182);
}

View File

@ -1,24 +1,24 @@
package project.Sprites; package project.Sprites;
import project.Colors;
import project.Expo; import project.Expo;
import java.applet.Applet; import java.applet.Applet;
import java.awt.*; import java.awt.*;
public class player extends Applet { public class player extends Applet {
public static void make(Graphics g, int x, int y) { public static void make(Graphics g, int x, int y) {
Expo.setColor(g,colorsTemp.playerBody); Expo.setColor(g, SpriteColors.playerBody);
Expo.fillRectangle(g, x, y, x+35, y+60); Expo.fillRectangle(g, x, y, x+35, y+60);
Expo.setColor(g,colorsTemp.Tires); Expo.setColor(g, SpriteColors.Tires);
Expo.fillRectangle(g, x+5, y+8, x-5, y+28); Expo.fillRectangle(g, x+5, y+8, x-5, y+28);
Expo.fillRectangle(g, x+5, y+35, x-5, y+55); Expo.fillRectangle(g, x+5, y+35, x-5, y+55);
Expo.fillRectangle(g, x+30, y+8, x+40, y+28); Expo.fillRectangle(g, x+30, y+8, x+40, y+28);
Expo.fillRectangle(g, x+30, y+35, x+40, y+55); Expo.fillRectangle(g, x+30, y+35, x+40, y+55);
} }
} }
// Expo.setColor(g,colorsTemp.playerBody); // Expo.setColor(g,SpriteColors.playerBody);
// Expo.fillRectangle(g, 100, 100, 135, 160); // Expo.fillRectangle(g, 100, 100, 135, 160);
// Expo.setColor(g,colorsTemp.Tires); // Expo.setColor(g,SpriteColors.Tires);
// Expo.fillRectangle(g, 105, 108, 95, 128); // Expo.fillRectangle(g, 105, 108, 95, 128);
// Expo.fillRectangle(g, 105, 135, 95, 155); // Expo.fillRectangle(g, 105, 135, 95, 155);
// Expo.fillRectangle(g, 130, 108, 140, 128); // Expo.fillRectangle(g, 130, 108, 140, 128);