Package com.badlogic.gdx.physics.box2d

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


    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
   
 
      List<Contact> contactList = world.getContactList();
      for (int i = 0; i < contactList.size(); i++) {
        Contact contact = contactList.get(i);
        if (contact.isTouching()) {
          Object a = contact.getFixtureA().getBody().getUserData();
          Object b = contact.getFixtureB().getBody().getUserData();

          if (a instanceof CannonBall && b instanceof EnemyShip) {
            if(((CannonBall) a).life < 10) {
              ((EnemyShip) b).life -= 1;
              ((CannonBall) a).life = 10;
View Full Code Here


  private void doPhysics() {   
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);   
 
      List<Contact> contactList = world.getContactList();
      for (int i = 0; i < contactList.size(); i++) {
        Contact contact = contactList.get(i);
        if (contact.isTouching()) {
          Object a = contact.getFixtureA().getBody().getUserData();
          Object b = contact.getFixtureB().getBody().getUserData();

          if (a instanceof CannonBall && b instanceof EnemyShip) {
            if(((CannonBall) a).life < 10) {
              // TODO send enemy hit packet
//              ((EnemyShip) b).life -= 1;
View Full Code Here

TOP

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

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.