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


Java Fixture.setFilterData方法代码示例

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


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

示例1: die

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的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);
	}
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:22,代码来源:RookieCop.java

示例2: swapWorldLayers

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的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);
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:17,代码来源:Sheriff.java

示例3: die

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的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;
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:40,代码来源:Prisoner.java

示例4: die

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void die()
{
	removeFromWorldLayers(CGCWorld.getLH());
	swapped = true;
	
	Fixture f = body.getFixtureList().get(0);
	Filter fi = f.getFilterData();
	fi.categoryBits = BodyFactory.CAT_NON_INTERACTIVE;
	fi.maskBits = BodyFactory.MASK_NON_INTERACTIVE;
	f.setFilterData(fi);
	body.getFixtureList().set(0, f);
	body.setUserData(this);
	
	if (leftShooter != null)
	{
		if (rightShooter != null)
		{
			rightShooter.dismount();
		}
			leftShooter.dismount();
			sheriff.addTargeter();
	}

	sheriff.swapWorldLayers(CGCWorld.getLH());
	sheriff.getBody().setUserData(sheriff);
	TimerManager.removeTimer(dieClock);
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:28,代码来源:SteelHorse.java

示例5: load

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity,
		ObjectMap<String, String> value)
{
	PhysicsComponent physics = Mappers.physics.get(entity);
	
	Filter filter = new Filter();
	filter.categoryBits = physicsSystem.getCategories().getBits("box");
	
	for(Fixture fixture : physics.body.getFixtureList())
	{
		fixture.setFilterData(filter);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:BoxPlugin.java

示例6: kill

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void kill() {
    currentState = State.DEAD;
    Filter filter = new Filter();
    filter.maskBits = MarioBros.NOTHING_BIT;

    for (Fixture fixture : b2body.getFixtureList()) {
        fixture.setFilterData(filter);
    }

    b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
}
 
开发者ID:lbalmaceda,项目名称:libgdx_mario,代码行数:12,代码来源:Turtle.java

示例7: kill

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
private void kill() {
    MarioBros.manager.get("audio/music/mario_music.ogg", Music.class).stop();
    MarioBros.manager.get("audio/sounds/mariodie.wav", Sound.class).play();
    marioIsDead = true;
    Filter filter = new Filter();
    filter.maskBits = MarioBros.NOTHING_BIT;
    for (Fixture fixture : b2body.getFixtureList()) {
        fixture.setFilterData(filter);
    }
    b2body.applyLinearImpulse(new Vector2(0, 3), b2body.getWorldCenter(), true);
}
 
开发者ID:lbalmaceda,项目名称:libgdx_mario,代码行数:12,代码来源:Mario.java

示例8: setFilter

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void setFilter(short category, short mask){
	for (Fixture f : scene.getFixtures()){
		Filter filter = f.getFilterData();
		filter.categoryBits = category;
		filter.maskBits = mask;
		f.setFilterData(filter);
	}
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:9,代码来源:PhysicsComponent.java

示例9: load

import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
@Override
public void load(final OverlapScene scene, Entity entity, ObjectMap<String, String> value)
{
	TransformComponent transform = Mappers.transform.get(entity);
	PhysicsComponent physics = new PhysicsComponent();
	final SensorComponent sensor = new SensorComponent();
	
	// Create default sensor body
	Body body;
	BodyDef bodyDef = new BodyDef();
	
	bodyDef.allowSleep = true;
	bodyDef.awake = true;
	bodyDef.type = BodyType.StaticBody;
	
	body = physicsSystem.getWorld().createBody(bodyDef);
	body.setUserData(entity);
	
	FixtureDef fixtureDef = new FixtureDef();
	fixtureDef.isSensor = true;
	
	PolygonShape polygon = new PolygonShape();
	polygon.setAsBox(.5f, .5f);
	fixtureDef.shape = polygon;
	
	Filter filter = new Filter();
	filter.categoryBits = physicsSystem.getCategories().getBits("sensor");
	
	Fixture fixture = body.createFixture(fixtureDef);
	fixture.setFilterData(filter);
	sensor.sensorFixture = fixture;
	
	polygon.dispose();

	
	body.setTransform(transform.position, transform.angle);
	physics.body = body;
	
	sensor.isEnabled = true;
	sensor.sensorReactionEnter = new Runnable()
	{
		@Override
		public void run()
		{
			if(sensor.isEnabled)
			{
				EventManager.fireEvent(scene, new Event(EventType.END_OF_LEVEL, false, false));
				sensor.isEnabled = false;
			}
		}
	};
	sensor.isPlayerSensible = true;
	sensor.isBoxSensible = false;
	
	entity.add(physics);
	entity.add(sensor);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:58,代码来源:EndOfLevelPlugin.java


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