瀏覽代碼

Reversed fuckup

Supermaniac101 10 年之前
父節點
當前提交
a19c0caf0d
共有 3 個文件被更改,包括 16 次插入15 次删除
  1. 4 6
      src/gui/simulator/AccessPoint.java
  2. 4 4
      src/gui/simulator/ExitPoint.java
  3. 8 5
      src/gui/simulator/Terrain.java

+ 4 - 6
src/gui/simulator/AccessPoint.java

@@ -42,16 +42,14 @@ public class AccessPoint extends Draw{
 
     @Override
     public void setY(double y){
-    	double oldPosX = this.getX();
     	double oldPosY = this.getY();
     	if(y<50){
-    		this.setRotation(180);
+    		this.setRotation(0);
     		this.y = 50;     
-    	} else if(y>terrain.getFestivalLength()-150){
+    	} else if(y>11*terrain.getFestivalLength()/12){
     		this.setRotation(0);
-    		this.y = terrain.getFestivalLength()-150; 	
-    	} else if(x>1*terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
-    		this.x = oldPosX;
+    		this.y = 11*terrain.getFestivalLength()/12; 	
+    	} else if(x>terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
     		this.y = oldPosY;
     	} else {
     		this.y = y;

+ 4 - 4
src/gui/simulator/ExitPoint.java

@@ -26,7 +26,7 @@ public class ExitPoint extends Draw{
     	} else if(x>9*terrain.getWidth()/10){
     		this.x = 9*terrain.getWidth()/10;
     		this.setRotation(90);
-    	} else if(x>0 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getLength()-150){
+    	} else if(x>0 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
     		this.x = oldPosX;
     		this.y = oldPosY;
     	} else {
@@ -40,10 +40,10 @@ public class ExitPoint extends Draw{
     	if(y<50){
     		this.setRotation(0);
     		this.y = 50;     
-    	} else if(y>11*terrain.getLength()/12){
+    	} else if(y>11*terrain.getFestivalLength()/12){
     		this.setRotation(0);
-    		this.y = 11*terrain.getLength()/12; 	
-    	} else if(x>terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getLength()-150){
+    		this.y = 11*terrain.getFestivalLength()/12; 	
+    	} else if(x>terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getFestivalLength()-150){
     		this.y = oldPosY;
     	} else {
     		this.y = y;

+ 8 - 5
src/gui/simulator/Terrain.java

@@ -83,15 +83,15 @@ public class Terrain extends JPanel {
     	Point2D clickPoint = getClickPoint(e.getPoint());
     	if(e.getX() < 200)
 		{
-			if(e.getY() < 300){
+    		if(e.getY() < 300){
 				dragObject = new Stage((int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
-			}else if(e.getY() > 300 && e.getY() < 550){
+			}else if(e.getY() > 300 && e.getY() < 500){
 				dragObject = new RestRoom((int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
-			}else if(e.getY() > 550 && e.getY() < 800){
+			}else if(e.getY() > 500 && e.getY() < 700){
 				dragObject = new AccessPoint(this, (int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
 			}
-			else if(e.getY() > 800 && e.getY() < 1100){
-				//dragObject = new custom facility
+			else if(e.getY() > 700 && e.getY() < 900){
+				dragObject = new ExitPoint(this, (int)clickPoint.getX(),(int)clickPoint.getY(), 0.5, 10);
 			}
 			entities.add(dragObject);
 		}
@@ -212,6 +212,9 @@ public class Terrain extends JPanel {
         Draw object3 = new AccessPoint(this, 0,550, 0.5, 10);
         object3.draw(g2);
         g2.drawString("ingang", 70, 675);
+        Draw object4 = new ExitPoint(this, 0,700, 0.5, 10);
+        object4.draw(g2);
+        g2.drawString("uitgang", 70, 800);
 		
 		//draw simulation field
 		g2.setClip(new Rectangle2D.Double(200, 0, getWidth()-200, getHeight()));