NPC spawning started
Signed-off-by: officereso <qrs01@snowtx.com>
This commit is contained in:
parent
a6ab0c9347
commit
be3b16cd7b
@ -18,7 +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));
|
||||
//project.Sprites.NPC.NPC(g,Expo.random(110,390));
|
||||
}
|
||||
|
||||
public static void end(Graphics g){
|
||||
|
@ -1,5 +1,7 @@
|
||||
package project;
|
||||
|
||||
import project.Sprites.NPC;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.awt.*;
|
||||
|
||||
@ -10,6 +12,8 @@ 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){
|
||||
Expo.drawHeading(g, "Quentin Snow and Alekkai", "Final Project");
|
||||
@ -17,6 +21,7 @@ public class Main extends Applet {
|
||||
Draw.begin(g);
|
||||
playerLocomotion(g);
|
||||
npcLocomotion(g);
|
||||
|
||||
}
|
||||
else{
|
||||
Draw.startScreen(g);
|
||||
@ -33,30 +38,31 @@ public class Main extends Applet {
|
||||
}
|
||||
|
||||
public static void npcLocomotion(Graphics g){
|
||||
project.Sprites.NPC1 npc1 = new project.Sprites.NPC1(g);
|
||||
int v = 70;
|
||||
int y = 100;
|
||||
v++;
|
||||
npc1.make(g,v,y);
|
||||
|
||||
System.out.println(v);
|
||||
if (spwNpc1){
|
||||
NPC npc1 = new NPC(g);
|
||||
spwNpc1 = false;
|
||||
}
|
||||
if (spwNpc2){
|
||||
NPC npc2 = new NPC(g);
|
||||
spwNpc2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean mouseDown(Event e, int x, int y){
|
||||
btnException = true;
|
||||
if (startBtn.inside(x,y)){
|
||||
start = true;
|
||||
repaint();
|
||||
}
|
||||
if (lBtn.inside(x,y)){
|
||||
Px-=10;
|
||||
repaint();
|
||||
}
|
||||
if (rBtn.inside(x,y)){
|
||||
Px+=10;
|
||||
repaint();
|
||||
}
|
||||
|
||||
btnException = false;
|
||||
repaint();
|
||||
System.out.println(x+" "+y);
|
||||
return true;
|
||||
}
|
||||
|
@ -5,12 +5,9 @@ import project.Expo;
|
||||
import java.applet.Applet;
|
||||
import java.awt.*;
|
||||
|
||||
public class NPC1 extends Applet {
|
||||
public NPC1(Graphics g) {
|
||||
|
||||
}
|
||||
public static void make(Graphics g, int x, int y){
|
||||
// int x = Expo.random(100,400);
|
||||
public class NPC extends Thread {
|
||||
public NPC(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);
|
||||
@ -19,6 +16,17 @@ public class NPC1 extends Applet {
|
||||
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);
|
Loading…
x
Reference in New Issue
Block a user