Explorar el Código

Finished entrance, still a little buggy

Supermaniac101 hace 10 años
padre
commit
a508c4e786
Se han modificado 1 ficheros con 21 adiciones y 50 borrados
  1. 21 50
      src/gui/simulator/AccessPoint.java

+ 21 - 50
src/gui/simulator/AccessPoint.java

@@ -24,65 +24,36 @@ public class AccessPoint extends Draw{
     
     @Override
     public void setX(double x){
-    	if(x>0 && x<terrain.getWidth()/6){
+    	double oldPosX = this.getX();
+    	double oldPosY = this.getY();
+    	if(x<0){
     		this.setRotation(90);
-    		this.x = -50; 
-    	} else if(x>=terrain.getWidth()/6 && x<5*terrain.getWidth()/6){
-    		this.x = x;
-    		this.setRotation(180);
-    	} else if(x>=terrain.getWidth()/6 && x<5*terrain.getWidth()/6 && this.getHeight()>0 && this.getHeight()<terrain.getLength()/4){
-    		this.x = x;
-    		this.setRotation(180);
-    	} else if(x>=terrain.getWidth()/6 && x<5*terrain.getWidth()/6 && this.getHeight()>3*(terrain.getLength()/4) && this.getHeight()<terrain.getLength()){
-    		this.x = x;
-    		this.setRotation(180);
-    	} else if(x>=5*(terrain.getWidth()/6) && x<=terrain.getWidth()){
+    		this.x = 0; 
+    	} else if(x>9*terrain.getWidth()/10){
+    		this.x = 9*terrain.getWidth()/10;
     		this.setRotation(90);
-    		this.x = terrain.getWidth()-200;
-    	}
-    	else if(x<0){
-    		this.setRotation(90);
-    		this.x = -50;
-    	}
-    	else if(x>terrain.getWidth()){
-    		this.setRotation(90);
-    		this.x = terrain.getWidth()-200;
-    	}
-    	else {
+    	} else if(x>0 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getLength()-150){
+    		this.x = oldPosX;
+    		this.y = oldPosY;
+    	} else {
     		this.x = x;
-    		this.setRotation(180);
     	}
     }
 
     @Override
     public void setY(double y){
-    	if(y>0 && y<terrain.getLength()/6){
-    		this.setRotation(90);
-    		this.y = 100;     
-    	} else if(y>0 && y<terrain.getLength()/6&& this.getX()>terrain.getWidth()/6 && this.getX()<5*terrain.getWidth()/6){
-    		this.y = 100; 
-        		this.setRotation(180);	
-    	} else if(y>=terrain.getLength()/6 && y<5*terrain.getLength()/6){
-    		this.y = y;
-    		this.setRotation(90);
-    	}
-    	else if(y>=5*(terrain.getLength()/6) && y<=terrain.getLength()){
-    		this.setRotation(90);
-    		this.y = terrain.getLength()-200;
-    	}
-    	else if(y>=5*(terrain.getLength()/6) && y<=terrain.getLength() && this.getX()>terrain.getWidth()/6 && this.getX()<5*terrain.getWidth()/6){
+    	double oldPosX = this.getX();
+    	double oldPosY = this.getY();
+    	if(y<50){
     		this.setRotation(180);
-    		this.y = terrain.getLength()-200;
-    	}
-    	else if(y<0){
-    		this.setRotation(180);
-    		this.y = 100;
-    	}
-    	else if(y>terrain.getLength()){
-    		this.setRotation(180);
-    		this.y = terrain.getLength()-200;
-    	}
-    	else {
+    		this.y = 50;     
+    	} else if(y>terrain.getLength()-150){
+    		this.setRotation(0);
+    		this.y = terrain.getLength()-150; 	
+    	} else if(x>1*terrain.getWidth()/10 && x<9*terrain.getWidth()/10 && this.y > 50 && this.y < terrain.getLength()-150){
+    		this.x = oldPosX;
+    		this.y = oldPosY;
+    	} else {
     		this.y = y;
     	}
     }