From 83feeb11b97fa81c45141288f6e5c544e15c2afc Mon Sep 17 00:00:00 2001 From: apeterescam1982 Date: Tue, 21 May 2019 15:26:43 -0500 Subject: [PATCH] Random NPC spawns --- src/project/Draw.java | 1 + src/project/Main.java | 3 +-- src/project/Sprites/NPC1.java | 25 +++++++++++++++++++++++++ src/project/Sprites/NPC2.java | 18 ++++++++++++++++++ src/project/Sprites/NPC3.java | 18 ++++++++++++++++++ src/project/Sprites/NPC4.java | 18 ++++++++++++++++++ src/project/Sprites/NPC5.java | 18 ++++++++++++++++++ src/project/Sprites/colorsTemp.java | 5 +++++ 8 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 src/project/Sprites/NPC1.java create mode 100644 src/project/Sprites/NPC2.java create mode 100644 src/project/Sprites/NPC3.java create mode 100644 src/project/Sprites/NPC4.java create mode 100644 src/project/Sprites/NPC5.java diff --git a/src/project/Draw.java b/src/project/Draw.java index bb64d18..fd9f55d 100644 --- a/src/project/Draw.java +++ b/src/project/Draw.java @@ -18,6 +18,7 @@ public class Draw extends Applet { public static void begin(Graphics g){ road(g); LRbtn(g); + //project.Sprites.NPC1.NPC1(g,Expo.random(110,390)); } public static void LRbtn(Graphics g){ diff --git a/src/project/Main.java b/src/project/Main.java index bcc6eeb..c0b1a8e 100644 --- a/src/project/Main.java +++ b/src/project/Main.java @@ -38,7 +38,6 @@ public class Main extends Applet { public static void test(Graphics g){ - // put testing code and calls here - + project.Sprites.NPC1.NPC1(g,Expo.random(100,400)); } } diff --git a/src/project/Sprites/NPC1.java b/src/project/Sprites/NPC1.java new file mode 100644 index 0000000..85e9070 --- /dev/null +++ b/src/project/Sprites/NPC1.java @@ -0,0 +1,25 @@ +package project.Sprites; + +import project.Colors; +import project.Expo; +import java.applet.Applet; +import java.awt.*; + +public class NPC1 extends Applet { + public static void NPC1(Graphics g, int x) { + 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 new file mode 100644 index 0000000..2ae9424 --- /dev/null +++ b/src/project/Sprites/NPC2.java @@ -0,0 +1,18 @@ +package project.Sprites; + +import project.Colors; +import project.Expo; +import java.applet.Applet; +import java.awt.*; + +public class NPC2 extends Applet { + public static void NPC2(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 new file mode 100644 index 0000000..39f7046 --- /dev/null +++ b/src/project/Sprites/NPC3.java @@ -0,0 +1,18 @@ +package project.Sprites; + +import project.Colors; +import project.Expo; +import java.applet.Applet; +import java.awt.*; + +public class NPC3 extends Applet { + public static void NPC3(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 new file mode 100644 index 0000000..27eb2d6 --- /dev/null +++ b/src/project/Sprites/NPC4.java @@ -0,0 +1,18 @@ +package project.Sprites; + +import project.Colors; +import project.Expo; +import java.applet.Applet; +import java.awt.*; + +public class NPC4 extends Applet { + public static void NPC4(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 new file mode 100644 index 0000000..ef3c440 --- /dev/null +++ b/src/project/Sprites/NPC5.java @@ -0,0 +1,18 @@ +package project.Sprites; + +import project.Colors; +import project.Expo; +import java.applet.Applet; +import java.awt.*; + +public class NPC5 extends Applet { + public static void NPC5(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/colorsTemp.java b/src/project/Sprites/colorsTemp.java index a03effa..20aee72 100644 --- a/src/project/Sprites/colorsTemp.java +++ b/src/project/Sprites/colorsTemp.java @@ -10,4 +10,9 @@ public class colorsTemp { 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); }