diff --git a/src/project/Colors.java b/src/project/Colors.java index 7852629..debe8ef 100644 --- a/src/project/Colors.java +++ b/src/project/Colors.java @@ -7,8 +7,6 @@ import java.awt.*; public class Colors { 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 red = new Color(255, 6, 0); static final Color endGreen = new Color(150, 255, 0); diff --git a/src/project/Draw.java b/src/project/Draw.java index 7ca06d0..7eefc94 100644 --- a/src/project/Draw.java +++ b/src/project/Draw.java @@ -1,5 +1,3 @@ -// This module was created by Quentin Snow - package project; import java.applet.Applet; diff --git a/src/project/Expo.java b/src/project/Expo.java index 605abf6..131ba40 100644 --- a/src/project/Expo.java +++ b/src/project/Expo.java @@ -5,8 +5,7 @@ package project;// THE EXPO CLASS FOR INTRO/CP COMPUTER SCIENCE import javax.swing.*; import java.awt.*; -import java.util.*; -import java.applet.Applet; +import java.util.Scanner; /** * @@ -307,7 +306,7 @@ public class Expo case 8 : g.setColor(gray); currentColor = gray; break; case 9 : g.setColor(pink); currentColor = pink; break; 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) { - int xCoord[] = new int[sides]; - int yCoord[] = new int[sides]; + int[] xCoord = new int[sides]; + int[] yCoord = new int[sides]; double rotate; if (sides % 2 == 1) @@ -682,8 +681,8 @@ public class Expo int p = points; points *= 2; - int xCoord[] = new int[points]; - int yCoord[] = new int[points]; + int[] xCoord = new int[points]; + int[] yCoord = new int[points]; int currentRadius; @@ -839,8 +838,8 @@ public class Expo **/ public static void fillRegularPolygon(Graphics g, int centerX, int centerY, int radius, int sides) { - int xCoord[] = new int[sides]; - int yCoord[] = new int[sides]; + int[] xCoord = new int[sides]; + int[] yCoord = new int[sides]; double rotate; if (sides % 2 == 1) @@ -902,8 +901,8 @@ public class Expo int p = points; points *= 2; - int xCoord[] = new int[points]; - int yCoord[] = new int[points]; + int[] xCoord = new int[points]; + int[] yCoord = new int[points]; int currentRadius; diff --git a/src/project/Main.java b/src/project/Main.java index 120c40b..ca34daa 100644 --- a/src/project/Main.java +++ b/src/project/Main.java @@ -12,7 +12,6 @@ public class Main extends Applet { private Rectangle lBtn = new Rectangle(480,220,120,80); private Rectangle rBtn = new Rectangle(630,220,120,80); private static int Px = 150; - private static boolean btnException = true; private static boolean spwNpc1, spwNpc2 = true; public void paint(Graphics g){ @@ -50,7 +49,6 @@ public class Main extends Applet { public boolean mouseDown(Event e, int x, int y){ - btnException = true; if (startBtn.inside(x,y)){ start = true; } @@ -60,8 +58,6 @@ public class Main extends Applet { if (rBtn.inside(x,y)){ Px+=10; } - - btnException = false; repaint(); System.out.println(x+" "+y); return true; diff --git a/src/project/Sprites/NPC.java b/src/project/Sprites/NPC.java index 4e3ba89..48efddc 100644 --- a/src/project/Sprites/NPC.java +++ b/src/project/Sprites/NPC.java @@ -1,37 +1,32 @@ package project.Sprites; -import project.Colors; import project.Expo; + import java.applet.Applet; import java.awt.*; -public class NPC extends Thread { +public class NPC extends Applet { public NPC(Graphics g) { + int x = Expo.random(100, 400); + Expo.setColor(g, SpriteColors.NPC1Body); + Expo.fillRectangle(g, x, 110, x + 35, 170); + Expo.setColor(g, SpriteColors.Tires); + Expo.fillRectangle(g, x + 5, 118, x - 5, 138); + Expo.fillRectangle(g, x + 5, 145, x - 5, 165); + Expo.fillRectangle(g, x + 30, 118, x + 40, 138); + Expo.fillRectangle(g, x + 30, 145, x + 40, 165); + } +} +/* + public static void make(Graphics g){ 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.setColor(g,colorsTemp.Tires); + Expo.setColor(g,SpriteColors.Tires); Expo.fillRectangle(g, x+5, 118, x-5, 138); Expo.fillRectangle(g, x+5, 145, x-5, 165); Expo.fillRectangle(g, x+30, 118, x+40, 138); Expo.fillRectangle(g, x+30, 145, x+40, 165); - } - public static void make(Graphics g){ - int x = Expo.random(100,400); - Expo.setColor(g,colorsTemp.NPC1Body); - Expo.fillRectangle(g, x, 110, x+35, 170); - Expo.setColor(g,colorsTemp.Tires); - Expo.fillRectangle(g, x+5, 118, x-5, 138); - Expo.fillRectangle(g, x+5, 145, x-5, 165); - Expo.fillRectangle(g, x+30, 118, x+40, 138); - 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); \ No newline at end of file +}*/ diff --git a/src/project/Sprites/NPC2.java b/src/project/Sprites/NPC2.java deleted file mode 100644 index 3c2c0e0..0000000 --- a/src/project/Sprites/NPC2.java +++ /dev/null @@ -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); - } -} diff --git a/src/project/Sprites/NPC3.java b/src/project/Sprites/NPC3.java deleted file mode 100644 index 02b52fd..0000000 --- a/src/project/Sprites/NPC3.java +++ /dev/null @@ -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); - } -} diff --git a/src/project/Sprites/NPC4.java b/src/project/Sprites/NPC4.java deleted file mode 100644 index 3a40190..0000000 --- a/src/project/Sprites/NPC4.java +++ /dev/null @@ -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); - } -} diff --git a/src/project/Sprites/NPC5.java b/src/project/Sprites/NPC5.java deleted file mode 100644 index 100fd18..0000000 --- a/src/project/Sprites/NPC5.java +++ /dev/null @@ -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); - } -} diff --git a/src/project/Sprites/SpriteColors.java b/src/project/Sprites/SpriteColors.java new file mode 100644 index 0000000..cb7fc09 --- /dev/null +++ b/src/project/Sprites/SpriteColors.java @@ -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); +} diff --git a/src/project/Sprites/colorsTemp.java b/src/project/Sprites/colorsTemp.java deleted file mode 100644 index 20aee72..0000000 --- a/src/project/Sprites/colorsTemp.java +++ /dev/null @@ -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); -} diff --git a/src/project/Sprites/player.java b/src/project/Sprites/player.java index 1b980f8..42bfd2b 100644 --- a/src/project/Sprites/player.java +++ b/src/project/Sprites/player.java @@ -1,24 +1,24 @@ package project.Sprites; -import project.Colors; import project.Expo; + import java.applet.Applet; import java.awt.*; public class player extends Applet { 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.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+35, x-5, y+55); Expo.fillRectangle(g, x+30, y+8, x+40, y+28); 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.setColor(g,colorsTemp.Tires); +// Expo.setColor(g,SpriteColors.Tires); // Expo.fillRectangle(g, 105, 108, 95, 128); // Expo.fillRectangle(g, 105, 135, 95, 155); // Expo.fillRectangle(g, 130, 108, 140, 128);