2019-05-18 19:35:36 -05:00
|
|
|
package project;
|
|
|
|
|
2019-05-17 15:08:45 -05:00
|
|
|
import java.applet.Applet;
|
|
|
|
import java.awt.*;
|
|
|
|
|
2019-05-18 22:11:42 -05:00
|
|
|
|
2019-05-19 17:07:54 -05:00
|
|
|
public class Main extends Applet {
|
2019-05-21 20:26:01 -05:00
|
|
|
private static boolean start = false;
|
2019-05-20 15:25:25 -05:00
|
|
|
private Rectangle startBtn = new Rectangle(100,100,340,600);
|
2019-05-21 20:26:01 -05:00
|
|
|
private Rectangle lBtn = new Rectangle(480,220,120,80);
|
|
|
|
private Rectangle rBtn = new Rectangle(630,220,120,80);
|
|
|
|
private static int Px = 150;
|
2019-05-20 15:25:25 -05:00
|
|
|
|
2019-05-19 17:07:54 -05:00
|
|
|
public void paint(Graphics g){
|
|
|
|
Expo.drawHeading(g, "Quentin Snow and Alekkai", "Final Project");
|
2019-05-20 15:25:25 -05:00
|
|
|
if (start){
|
|
|
|
Draw.begin(g);
|
2019-05-21 15:19:55 -05:00
|
|
|
playerLocomotion(g);
|
2019-05-20 15:25:25 -05:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
Draw.startScreen(g);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-21 20:26:01 -05:00
|
|
|
|
2019-05-21 15:19:55 -05:00
|
|
|
public static void playerLocomotion(Graphics g){
|
2019-05-21 20:26:01 -05:00
|
|
|
project.Sprites.player.make(g,Px,427);
|
|
|
|
if (Px <= 107|| Px >= 375){
|
|
|
|
Draw.end(g);
|
|
|
|
Px = 10000;
|
|
|
|
}
|
2019-05-21 15:19:55 -05:00
|
|
|
}
|
|
|
|
|
2019-05-21 20:26:01 -05:00
|
|
|
|
2019-05-20 15:25:25 -05:00
|
|
|
public boolean mouseDown(Event e, int x, int y){
|
|
|
|
if (startBtn.inside(x,y)){
|
|
|
|
start = true;
|
|
|
|
repaint();
|
|
|
|
}
|
2019-05-21 20:26:01 -05:00
|
|
|
if (lBtn.inside(x,y)){
|
|
|
|
Px-=10;
|
|
|
|
repaint();
|
|
|
|
}
|
|
|
|
if (rBtn.inside(x,y)){
|
|
|
|
Px+=10;
|
|
|
|
repaint();
|
2019-05-21 15:25:21 -05:00
|
|
|
}
|
2019-05-21 20:26:01 -05:00
|
|
|
|
2019-05-21 15:19:55 -05:00
|
|
|
System.out.println(x+" "+y);
|
2019-05-20 15:25:25 -05:00
|
|
|
return true;
|
2019-05-17 15:08:45 -05:00
|
|
|
}
|
2019-05-17 15:01:03 -05:00
|
|
|
}
|