Package org.filsa.nikujaga.pong.math

Examples of org.filsa.nikujaga.pong.math.Vec2


  public Vec2 pos = new Vec2();
  public Vec2 dir = new Vec2(1,1);
  public int size = 20;
 
  public Ball () {
    pos = new Vec2(1, 0);
  }
View Full Code Here


  public Ball () {
    pos = new Vec2(1, 0);
  }
 
  public Ball(int startX, int startY){
    pos = new Vec2(startX, startY);
  }
View Full Code Here

      newY = ball.dir.y * -1.0;
      collided = true;
    }

    if (collided) {
      ball.dir = new Vec2(newX, newY);
    }
  }
View Full Code Here

    if (player.pos.intY() < yMin || player.pos.intY() + player.height > yMax) {
      newY = player.dir.y * -1.0;
      collided = true;
    }
    if (collided) {
      player.dir = new Vec2(player.dir.x, newY);
    }

  }
View Full Code Here

  @Override
  public void tick() {
    super.tick();
   
    if (followBall(60)) {
      this.dir = new Vec2(dir.x, dir.y * -1.0);
    }
  }
 
View Full Code Here

  public boolean isCollided = false;
 
  private Logger log = LoggerFactory.getLogger(Goalie.class);

  public Goalie(int startX, int startY) {
    pos = new Vec2(startX, startY);
   
    this.xMin = startX;
    this.xMax = startX + width;
  }
View Full Code Here

      log.info(this.toString() + ball.toString());
    }
   

    if (collided) {
      ball.dir = new Vec2(newX, newY);
    }
  }
View Full Code Here

TOP

Related Classes of org.filsa.nikujaga.pong.math.Vec2

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.