当前位置: 首页>>代码示例>>Java>>正文


Java Contact.getFixtureA方法代码示例

本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Contact.getFixtureA方法的典型用法代码示例。如果您正苦于以下问题:Java Contact.getFixtureA方法的具体用法?Java Contact.getFixtureA怎么用?Java Contact.getFixtureA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.physics.box2d.Contact的用法示例。


在下文中一共展示了Contact.getFixtureA方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override public void endContact(Contact contact) {
    Fixture fixture = null;
    Ball ball = ballWithBody(contact.getFixtureA().getBody());
    if (ball != null) {
        fixture = contact.getFixtureB();
    }
    else {
        ball = ballWithBody(contact.getFixtureB().getBody());
        if (ball != null) {
            fixture = contact.getFixtureA();
        }
    }

    if (ball != null) {
        contactedBalls.add(ball);
        contactedFixtures.add(fixture);
    }
}
 
开发者ID:StringMon,项目名称:homescreenarcade,代码行数:19,代码来源:Field.java

示例2: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void beginContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    ContactHandler handler;
    handler = beginContactFunctions.get(fixA.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixA, fixB);

    handler = beginContactFunctions.get(fixB.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixB, fixA);

}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:19,代码来源:WorldContactListener.java

示例3: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void endContact(Contact contact) {
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    ContactHandler handler;
    handler = endContactFunctions.get(fixA.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixA, fixB);

    handler = endContactFunctions.get(fixB.getFilterData().categoryBits);
    if (handler != null)
        handler.handle(fixB, fixA);

}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:19,代码来源:WorldContactListener.java

示例4: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {

    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();
    if (fixA.getUserData() == "bottom" || fixB.getUserData() == "bottom") {
        Fixture bottom = fixA.getUserData() == "bottom" ? fixA : fixB;
        Fixture object = bottom == fixA ? fixB : fixA;

        //resets object touched
        if (object.getUserData() != null &&
                InteractiveTileObject.class.isAssignableFrom(object.getUserData().getClass())) {
            isObjectTouched = NoObjectionGame.DEFAULT;
        }
    }

}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:18,代码来源:WorldContactListener.java

示例5: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	// 夹具为空时,碰撞直接返回不执行。
	if (fixtureA == null || fixtureB == null) {
		return;
	}

	//孙悟空跳跃结束
	if (fixtureA.getUserData() != null && fixtureA.getUserData().equals("foot")) {
		// 计数器减1
		platformNum--;
	}
	if (fixtureB.getUserData() != null && fixtureB.getUserData().equals("foot")) {
		// 计数器减1
		platformNum--;
	}
}
 
开发者ID:heyzqt,项目名称:libGdx-xiyou,代码行数:20,代码来源:Box2DContactListener.java

示例6: handleFootContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
private void handleFootContact(Contact contact, boolean onBeginContact) {
    Fixture footSensor = getFootSensor();
    if (contact.getFixtureA() == footSensor || contact.getFixtureB() == footSensor) {
        Fixture otherFixture =
                (footSensor == contact.getFixtureA()) ? contact.getFixtureB() : contact.getFixtureA();
        if (!otherFixture.isSensor()) {
            if (onBeginContact) {
                if (numFootContacts == 0) {
                    land();
                }

                numFootContacts++;
            } else {
                numFootContacts--;
            }

            numFootContacts = Math.max(0, numFootContacts);
        }
    }
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:21,代码来源:Player.java

示例7: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
	// TODO Auto-generated method stub
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	//logger.info("contact");
	if (state == GAME_RUNNING) {
		if (fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER &&
				fixtureB.getFilterData().categoryBits == CATEGORY_ENEMY) {
			//fixtureA.getFilterData().maskBits = 0;
			state = GAME_OVER_SETUP;
		}
		
		else if (fixtureA.getFilterData().categoryBits == CATEGORY_ENEMY &&
				fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER) {
			//fixtureB.getFilterData().maskBits = 0;
			state = GAME_OVER_SETUP;
		}
	}
	
	if ((fixtureA.isSensor() == true && fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER)
			|| (fixtureB.isSensor() == true && fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER)) {
		state = BALL_DESTROYED;
	}
}
 
开发者ID:zozotintin,项目名称:Dodgy-Dot,代码行数:27,代码来源:GameScreen.java

示例8: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
    // End the collision.
    Fixture fixtureA = contact.getFixtureA(), fixtureB = contact.getFixtureB();

    // This is another way for guessing which fixture are you working with. If you have
    // the reference to that fixture you can just check if both variable reference the
    // same instance.
    if (fixtureA == minijoeFixture && fixtureB == floorFixture) {
        isJumping = true;
    }

    if (fixtureA == floorFixture && fixtureB == minijoeFixture) {
        isJumping = true;
    }
}
 
开发者ID:danirod,项目名称:jumpdontdie,代码行数:17,代码来源:Box2DScreen.java

示例9: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
	Fixture fixA = contact.getFixtureA();
	Fixture fixB = contact.getFixtureB();

	if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
		Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
           ((Player) objA.getUserData()).setTouching(true);
           collision.play();
	}
}
 
开发者ID:edwardszczepanski,项目名称:QuackHack,代码行数:12,代码来源:WorldContactListener.java

示例10: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
	Fixture fixA = contact.getFixtureA();
	Fixture fixB = contact.getFixtureB();

       if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
           Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
           ((Player) objA.getUserData()).setTouching(false);
       }

}
 
开发者ID:edwardszczepanski,项目名称:QuackHack,代码行数:12,代码来源:WorldContactListener.java

示例11: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
public void beginContact(Contact contact) 
{
	if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
			contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
			(GameEntity)contact.getFixtureA().getBody().getUserData() == null || 
			(GameEntity)contact.getFixtureB().getBody().getUserData() == null)
	{
		return;
	}

	Fixture fA = contact.getFixtureA();
	Fixture fB = contact.getFixtureB();
	Body a = contact.getFixtureA().getBody();
	Body b = contact.getFixtureB().getBody();
	GameEntity geA = (GameEntity)a.getUserData();
	GameEntity geB = (GameEntity)b.getUserData();
	
	if (geA.getType() == EntityType.CHAINLINK && geB.getType() == EntityType.CHAINLINK)
	{
		return;
	}
	
	geA.collide(geB);

	testPlayerCoin(geA, geB, true);
	testPlayerSensor(geA, geB, true);
	testPlayerMud(geA, geB, fA, fB, true);
	testPlayerWater(geA, geB, fA, fB, true);
	testPlayerTower(geA, geB, fA, fB, true);

	testPlayerChair(geA, geB, true);
	
	testPlayerBridge(geA, geB, fA, fB, true);
	testPlayerSpotlight(geA, geB, fA, fB, true);
	testCarrierCopChainLink(geA, geB, true);
	
	testSteelHorseWall(geA, geB, true);
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:39,代码来源:ContactManager.java

示例12: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
public void endContact(Contact contact)
{
	if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
			contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
			(GameEntity)contact.getFixtureA().getBody().getUserData() == null ||
			(GameEntity)contact.getFixtureB().getBody().getUserData() == null)
	{
		return;
	}


	Fixture fA = contact.getFixtureA();
	Fixture fB = contact.getFixtureB();
	Body a = contact.getFixtureA().getBody();
	Body b = contact.getFixtureB().getBody();
	GameEntity geA = (GameEntity)a.getUserData();
	GameEntity geB = (GameEntity)b.getUserData();

	testPlayerCoin(geA, geB, false);
	testPlayerSensor(geA, geB, false);
	testPlayerMud(geA, geB, fA, fB, false);
	testPlayerWater(geA, geB, fA, fB, false);
	testPlayerTower(geA, geB, fA, fB, false);

	testPlayerChair(geA, geB, false);

	testPlayerBridge(geA, geB, fA, fB, false);
	testPlayerSpotlight(geA, geB, fA, fB, false);
	testCarrierCopChainLink(geA, geB, false);

	testSteelHorseWall(geA, geB, false);
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:33,代码来源:ContactManager.java

示例13: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
	final Fixture a = contact.getFixtureA();
	final Fixture b = contact.getFixtureB();
	if (a == null || b == null)
		return;
	if ((a.getUserData().equals("food") && b.getUserData().equals("player"))) {
		playerHitsFood(b, a);
	} else if ((b.getUserData().equals("food") && a.getUserData().equals("player"))) {
		playerHitsFood(a, b);
	} else if ((b.getUserData().equals("food") && a.getUserData().equals("block"))) {
		foodHitsBlock(b, a);
	} else if ((a.getUserData().equals("food") && b.getUserData().equals("block"))) {
		foodHitsBlock(a, b);
	} else if ((a.getUserData().equals("player") && b.getUserData().equals("enemy"))) {
		playerHitsEnemy(a, b);
	} else if ((a.getUserData().equals("player") && b.getUserData().equals("plate"))) {
		playerHitsPlate(a, b);
	} else if ((b.getUserData().equals("player") && a.getUserData().equals("plate"))) {
		playerHitsPlate(b, a);
	} else if ((b.getUserData().equals("player") && a.getUserData().equals("goal"))) {
		playerHitsGoal(b, a);
	} else if ((b.getUserData().equals("player") && a.getUserData().equals("agariologic"))) {
		playerHitsAgarLogic(b, a);
	} else if ((a.getUserData().equals("food") && b.getUserData().equals("enemy"))) {
		foodHitsEnemy(a, b);
	} else if ((b.getUserData().equals("food") && a.getUserData().equals("enemy"))) {
		foodHitsEnemy(b, a);
	}
}
 
开发者ID:lvivtotoro,项目名称:advio,代码行数:31,代码来源:ContactListener.java

示例14: beginContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.beginContact(contact);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例15: endContact

import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.endContact(contact);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java


注:本文中的com.badlogic.gdx.physics.box2d.Contact.getFixtureA方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。