Package physics

Examples of physics.Vector2D


 
 
  public MovableEntity(int ID,int OwnerID ,int type,double mass) {
    super(ID,OwnerID, type);
    this.mass=mass;
    v=new Vector2D();
    a=new Vector2D();
    // TODO Auto-generated constructor stub
  }
View Full Code Here


  protected final double mass;

 
  public void setTheta(){
    try {
      theta = new Vector2D(oldLoc,loc).direction();
    } catch (NoDirectionException e) {
      theta=0;
    }
  }
View Full Code Here

    a.translate(v, 1D);
    a.set(0,0);
  }
 
  public void apply(Vector2D force){
    Vector2D a_=new Vector2D();
    a_.scale(1.0/mass,force);
    a.add(a_);
  }
View Full Code Here

  protected void MoveUnit(GameState g){ //move to some where else....
    if (moveTo != null && PhysicsUtility.distanceBetween(loc, moveTo) < 2) {
      v.set(0,0);
    }else{
        try {
          apply(new Vector2D(loc, moveTo).resize(moveForce));
        } catch (Exception e) {
          // Unit already at location, do nothing
          return;
        }
      if (v.length()>maxMoveSpeed){
View Full Code Here

 
  public final static int castLimit=25;//casts per 30 seconds
  public FireBall(int ID, int OwnerID, double theta,Point2D initialLoc) {
    super(ID, OwnerID, type,mass , moveForce, maxMoveSpeed, initialLoc,castLimit,10);
    this.theta=theta;
    v=new Vector2D(Math.cos(theta),Math.sin(theta));
    //particle=new ParticleTest(initialLoc.getX(), initialLoc.getY(), Enums.smokeParticle, theta, type);
  }
View Full Code Here

    super(ID, OwnerID,type,mass);
    //this.OwnerID = OwnerID;
    this.moveForce=moveForce;
    this.maxMoveSpeed=maxMoveSpeed;
    this.loc = initialLoc;
    this.v = new Vector2D();
    this.a = new Vector2D();
    this.timeout = timeout;
    this.castLimit=castlimit;
  }
View Full Code Here

 
  public RainbowCannon(int ID, int OwnerID,  double theta, Point2D initialLoc) {
    super(ID, OwnerID, type, mass, moveForce, maxMoveSpeed, initialLoc,castLimit,40);
    // TODO Auto-generated constructor stub
    this.theta=theta;
    v=new Vector2D(Math.cos(theta),Math.sin(theta));
  }
View Full Code Here

TOP

Related Classes of physics.Vector2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.