Package com.badlogic.gdx.physics.box2d

Examples of com.badlogic.gdx.physics.box2d.Body


      return false;
    }
   
    for(int i=0; i<3; i++) {
     
      Body box = createCircle(BodyType.DynamicBody, 0.01f, 10000);
      box.setBullet(true);    
      box.setTransform(position.x + i, position.y, 0);
      box.setLinearVelocity(velocity.mul(1000));

      bullets.add(new CannonBall(box, true));
      box.setUserData(bullets.get(bullets.size-1));
    }
   
    player.lastShot = 0;
   
    if(configuration.sound) {
View Full Code Here


  }
 
  public boolean shootEnemy(final Vector2 position, final Vector2 velocity) {   
    for(int i=0; i<3; i++) {
     
      Body box = createCircle(BodyType.DynamicBody, 0.01f, 10000);
      box.setBullet(true);    
      box.setTransform(position.x + i, position.y, 0);
      box.setLinearVelocity(velocity.mul(1000));

      bullets.add(new CannonBall(box, false));
      box.setUserData(bullets.get(bullets.size-1));
    }
    if(configuration.sound) {
      shoot.play();
    }
   
View Full Code Here

 
  public Body createCircle(BodyType type, float radius, float density) {
    BodyDef def = new BodyDef();
    def.type = type;
    def.linearDamping = 5;
    Body box = world.createBody(def);

    CircleShape poly = new CircleShape();
    poly.setRadius(radius);
    Fixture fix = box.createFixture(poly, density);
    poly.dispose();

    return box;
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.physics.box2d.Body

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.