瀏覽代碼

Revert "Visitor speed changed and scaling fixed"

This reverts commit 27f6091f3bb18cb0e6a21895486083d3c04cfd18.
Supermaniac101 10 年之前
父節點
當前提交
a5e001f1df
共有 4 個文件被更改,包括 4 次插入117 次删除
  1. 0 101
      src/gui/simulator/Draw.java
  2. 2 8
      src/gui/simulator/Terrain.java
  3. 1 7
      src/gui/simulator/Visitor.java
  4. 1 1
      src/gui/simulator/WalkingPath.java

+ 0 - 101
src/gui/simulator/Draw.java

@@ -1,101 +0,0 @@
-package gui.simulator;
-
-import javax.imageio.ImageIO;
-
-import java.awt.*;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.io.IOException;
-
-/**
- * Created by gjoosen on 07/03/15.
- * Edited by master D Mathijssen on 17-3-2015 and some other days
- */
-public abstract class Draw {
-
-    private Image image;
-    public double x, y, rotation, scale;
-    private double distanceToOtherObjects;
-
-    public Draw(String image, int x, int y, double scale, double distanceToOtherObjects){
-        try{
-            this.image = ImageIO.read(getClass().getResource(image));
-        }catch(IOException ex){
-            ex.printStackTrace();
-        }
-        this.x = x;
-        this.y = y;
-        this.scale = scale;
-        this.distanceToOtherObjects = distanceToOtherObjects;
-    }
-
-    public AffineTransform getAffineTransform(){
-        AffineTransform transform = new AffineTransform();
-        transform.translate(this.x, this.y);
-        transform.scale(this.scale, this.scale);
-        transform.rotate(Math.toRadians(this.rotation), this.image.getWidth(null) /2 , this.image.getHeight(null) / 2);
-        return transform;
-    }
-
-    public void draw(Graphics2D g){
-        g.drawImage(this.image, this.getAffineTransform(), null);
-    }
-
-    public boolean contains(Point2D point){
-        Shape shape = new Rectangle2D.Double(0, 0, image.getWidth(null), image.getHeight(null));
-        return this.getAffineTransform().createTransformedShape(shape).contains(point);
-    }
-    
-    public Image getImage(){
-    	return image;
-    }
-
-    //getters and setters down here
-    public double getX() {
-        return x;
-    }
-
-    public double getY() {
-        return y;
-    }
-
-    public void setX(double x){
-        this.x = x;
-    }
-
-    public void setY(double y){
-        this.y = y;
-    }
-
-    public void setRotation(double rotation) {
-        this.rotation = rotation;
-    }
-
-    public double getScale() {
-        return scale;
-    }
-
-    public void setScale(double scale) {
-    		this.scale = scale;  
-    }
-
-    public int getWidth(){
-        return this.image.getWidth(null);
-    }
-
-    public int getHeight(){
-        return this.image.getHeight(null);
-    }
-    public double getRotation() {
-        return rotation;
-    }
-
-    public double getDistanceToOtherObjects() {
-        return distanceToOtherObjects;
-    }
-
-    public Rectangle2D.Double getRect(){
-        return new Rectangle2D.Double(-distanceToOtherObjects, - distanceToOtherObjects, image.getWidth(null)  + 2* distanceToOtherObjects, image.getHeight(null) + 2*distanceToOtherObjects);
-    }
-}

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

@@ -242,14 +242,8 @@ public class Terrain extends JPanel {
                 	//if object selected, scale object
                     if(object.contains(clickPoint)){
 						double oldscale  = object.getScale();
-						if(oldscale < 0.3){
-							if((e.getPreciseWheelRotation()/10.0) > 0){
-								object.setScale(object.getScale() * 1 + (e.getPreciseWheelRotation()/10.0));
-							} 
-						} else {
-							object.setScale(object.getScale() * 1 + (e.getPreciseWheelRotation()/10.0));
-						}
-						
+						object.setScale(object.getScale() * 1 + (e.getPreciseWheelRotation()/10.0));
+
 						//intersect
 						for(DrawEngine draw: entities){
 							if(draw != object){

+ 1 - 7
src/gui/simulator/Visitor.java

@@ -23,13 +23,7 @@ public class Visitor {
 	public Visitor(Point2D positie) {
 		this.positie = positie;
 		this.rotation = 0;
-		double number = Math.random()*2;
-		if(number < 1){
-			this.speed = 1;
-		} else {
-			this.speed = number;
-		}
-		
+		this.speed = 1;
 		this.target = new Point2D.Double(0, 0);
 	}
 

+ 1 - 1
src/gui/simulator/WalkingPath.java

@@ -56,7 +56,7 @@ public class WalkingPath {
 		}
 	}
 	public void paint(Graphics2D g2){
-		g2.setStroke(new BasicStroke(40,BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+		g2.setStroke(new BasicStroke(20,BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
 		for(int i = 1; i < getPath().size(); i++){
 			g2.setPaint(new TexturePaint(texture, new Rectangle(0,0,100,100)));
 			g2.drawLine((int)get(i-1).getX(),(int)get(i-1).getY(), (int)get(i).getX(),(int)get(i).getY());