Package net.phys2d.raw

Examples of net.phys2d.raw.BodyList


   * Draw the whole simulation
   *
   * @param g The graphics context on which to draw
   */
  protected void draw(Graphics2D g) {
    BodyList bodies = world.getBodies();
   
    for (int i=0;i<bodies.size();i++) {
      Body body = bodies.get(i);
     
      drawBody(g, body);
    }
   
    JointList joints = world.getJoints();
View Full Code Here


  @Override
  public void poll(Input input, float secounds) {
    boolean canJump = false;

    if (this.couldTryToJump) {
      BodyList touching = this.body.getTouching();
      for (int i = 0; i < touching.size(); i++) {
        if (touching.get(i).getPosition().getY() > this.body
            .getPosition().getY() + 0.2f) {
          canJump = true;
          break;
        }
      }
View Full Code Here

    }
    if(input.isKeyDown(Input.KEY_SPACE)) {
      boolean canJump = false;

      if (this.couldTryToJump) {
        BodyList touching = this.body.getTouching();
        for (int i = 0; i < touching.size(); i++) {
          if (touching.get(i).getPosition().getY() > this.body
              .getPosition().getY() + 0.7f) {
            canJump = true;
            break;
          }
        }
View Full Code Here

        entityForBody(event.getBodyB()).collisionOccured(event, event.getBodyA());
      }
    });
   
    // Objekte informieren
    BodyList bodies = this.world.getBodies();
    for(int i = 0; i < bodies.size(); i++) {
      entityForBody(bodies.get(i)).simulatedWorldChanged(this);
    }
  }
View Full Code Here

  public void poll(Input input, float secounds) {
    // Fortschritt machen
    this.world.step();
     
    // Objekte informieren
    BodyList bodies = this.world.getBodies();
    for(int i = 0; i < bodies.size(); i++) {
      Body body = bodies.get(i);
      entityForBody(body).poll(input, Engine.TARGET_FPS);
    }
  }
View Full Code Here

 
  @Override
  public void draw(Graphics g) {
    doCameraTranslation(g);
   
    BodyList bodies = this.world.getBodies();
    for(int i = 0; i < bodies.size(); i++) {
      Body body = bodies.get(i);
      g.pushTransform();
      g.translate(body.getPosition().getX(), body.getPosition().getY());
      g.rotate(0.0f, 0.0f, (float) Math.toDegrees(body.getRotation()));
      entityForBody(body).draw(g);
      g.popTransform();
View Full Code Here

TOP

Related Classes of net.phys2d.raw.BodyList

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.