本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Filter类的典型用法代码示例。如果您正苦于以下问题:Java Filter类的具体用法?Java Filter怎么用?Java Filter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Filter类属于com.badlogic.gdx.physics.box2d包,在下文中一共展示了Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: die
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
public void die(DeathType death)
{
if(alive)
{
if (grabbed != null)
{
stopGrabbing(false);
}
gameWorld.startRespawnClock(this);
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_DECEASED;
fi.maskBits = BodyFactory.MASK_DECEASED;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
super.die(death);
}
}
示例2: swapWorldLayers
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
public void swapWorldLayers(LayerHandler lh)
{
removeFromWorldLayers(lh);
lh.addEntityToLayer(this, LayerHandler.ground);
swapped = true;
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_IMPASSABLE;
fi.maskBits = BodyFactory.MASK_SHERIFF_GROUND;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
canFire = false;
TimerManager.addTimer(swapTimer);
}
示例3: createBody
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
@Override
protected Body createBody(EntityDefinition definition) {
BodyDef bodyDef = definition.getBodyDef();
bodyDef.position.set(definition.getCenter());
Body body = Level.getInstance().getPhysicsWorld().createBody(bodyDef);
FixtureDef fixtureDef = createFixtureDef();
body.createFixture(fixtureDef);
fixtureDef.shape.dispose();
body.setBullet(true);
attachFootSensor(body, definition.getSize().x);
Filter filter = new Filter();
filter.categoryBits = 0x0001;
filter.maskBits = ~Player.COLLISION_MASK;
body.getFixtureList().get(0).setFilterData(filter);
return body;
}
示例4: WallActor
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
public WallActor(JumplingsWorld world, PointF worldPos, PointF p0, PointF p1, boolean floor, boolean security) {
super(world, worldPos, p0, p1, false);
Filter filter = (floor) ? FLOOR_FILTER : WALL_FILTER;
for (int i = 0; i < mBodies.size(); i++) {
Body b = mBodies.get(i);
// b.setBullet(true);
ArrayList<Fixture> fs = b.getFixtureList();
int l2 = fs.size();
for (int i2 = 0; i2 < l2; i2++) {
Fixture f = fs.get(i2);
f.setRestitution(WALL_RESTITUTION);
f.setFilterData(filter);
}
}
this.floor = floor;
this.security = security;
}
示例5: configEntity
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
private void configEntity(Entity entity) {
IdentityComponent identity = getComponent(entity, IdentityComponent.class, true);
identity.uuid = IDS++;
if (Settings.DEBUG_ENTITY != null) tag = String.format("%s::%s:", this.getClass().getSimpleName(), identity.tag);
if (!tagEntities.containsKey(identity.tag)) {
tagEntities.put(identity.tag, new Array<Entity>());
}
tagEntities.get(identity.tag).add(entity);
RigidBodiesComponents rigidBodies = getComponent(entity, RigidBodiesComponents.class, false);
if (rigidBodies != null) {
for (Body rigidBody : rigidBodies.rigidBodies) {
rigidBody.setUserData(entity);
for (Fixture fixture : rigidBody.getFixtureList()) {
Filter filter = new Filter();
filter.categoryBits = identity.category;
filter.maskBits = identity.collisionMask;
filter.groupIndex = identity.group;
fixture.setFilterData(filter);
}
}
}
}
示例6: setCollisionGroup
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Set a category group to all fixtures of a single body.
*
* @param group
* Id - Negative id does not collide with those with the same
* group id Positive id collides with only those with the same
* group id. Default is 0, which collides with everything;
*/
@Prop(name = "Collision Group")
public void setCollisionGroup(int group) {
// Create a filter
Filter filter;
// Set all fixtures of the body to the same Collision Group.
Array<Fixture> fixtures = mBody.getFixtureList();
for (Fixture f : fixtures) {
// Get the Current Filter data
filter = f.getFilterData();
// Change the group index
filter.groupIndex = (short) group;
// Apply the new filter to the fixture.
f.setFilterData(filter);
}
mCollisionGroup = group;
}
示例7: Bullet
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* @param textReg
* @param x
* @param y
* @param world
*/
public Bullet(TextureRegion textReg, float x, float y, World world) {
super(textReg, x, y, world, "bullet");
mBody.setBullet(true); // More accurate collision detection
for (Fixture fixture : mBody.getFixtureList()) {
fixture.setDensity(0);
fixture.setRestitution(1);
fixture.setFriction(0);
Filter filter = fixture.getFilterData();
filter.categoryBits = EEnityCategories.BULLET.getValue();
filter.maskBits &= ~EEnityCategories.BULLET.getValue();
fixture.setFilterData(filter);
}
mBody.setLinearDamping(0);
mSpeed = SPEED;
mDamage = 20f;
}
示例8: Enemy
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* @param textReg
* @param x
* @param y
* @param world
*/
public Enemy(TextureRegion textReg, float x, float y, World world) {
super(textReg, x, y, world, "square");
setAI(AI.RandomFactory(this));
mBody.setBullet(true); // More accurate collision detection
mBody.setFixedRotation(true);
Fixture fixture = mBody.getFixtureList().get(0);
fixture.setDensity(0.1f);
fixture.setRestitution(1);
fixture.setFriction(0);
Filter filter = fixture.getFilterData();
filter.categoryBits = EEnityCategories.ENEMY.getValue();
filter.maskBits = (short) (EEnityCategories.ALL.getValue() & ~EEnityCategories.ENEMY
.getValue());
fixture.setFilterData(filter);
mSpeed = SPEED;
mHealth = MAX_HEALTH;
mDamage = 5f;
}
示例9: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_WEAPON;
filter.maskBits = MainGameClass.MASK_WEAPON;
fixture.setFilterData(filter);
}
示例10: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_ENEMY_MOVE_BORDER;
filter.maskBits = MainGameClass.MASK_ENEMY_MOVE_BORDER;
fixture.setFilterData(filter);
}
示例11: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_DEATHTILE;
filter.maskBits = MainGameClass.MASK_DEATHTILE;
fixture.setFilterData(filter);
}
示例12: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_FINISH;
filter.maskBits = MainGameClass.MASK_FINISH;
fixture.setFilterData(filter);
}
示例13: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_GROUND;
filter.maskBits = MainGameClass.MASK_GROUND;
fixture.setFilterData(filter);
}
示例14: createFilterMask
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
/**
* Creates and sets the collision filter mask and category of this object
*/
@Override
public void createFilterMask() {
Filter filter = new Filter();
filter.categoryBits = MainGameClass.CATEGORY_JUMPABLE;
filter.maskBits = MainGameClass.MASK_JUMPABLE;
fixture.setFilterData(filter);
}
示例15: die
import com.badlogic.gdx.physics.box2d.Filter; //导入依赖的package包/类
public void die(DeathType death)
{
if(alive)
{
if (gameWorld instanceof BossFight)
{
((BossFight)gameWorld).startRespawnClock(this);
}
else
{
gameWorld.startRespawnClock(this);
}
if(death == DeathType.CAPTURE)
{
shouldMakeCorpse = false;
CGCWorld.addToDestroyList(this);
if (Options.storedTrackingOption)
{
ChaseApp.stats.getStatByIndex(getCurrentMapIndex()).captures++;
}
}
else
{
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_DECEASED;
fi.maskBits = BodyFactory.MASK_DECEASED;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
}
fixKeyIDs(playerID);
super.die(death);
alive = false;
}
rightJoint = null;
}