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


Java CircleShape.dispose方法代码示例

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


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

示例1: createSpinner

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public static Body createSpinner(World world) {
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;
    bodyDef.position.set(Constants.SPINNER_POSITIONS);
    Body body = world.createBody(bodyDef);
    CircleShape circle = new CircleShape();
    circle.setRadius(Constants.SPINNER_SIZE);
    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = circle;
    fixtureDef.density = Constants.SPENNER_DENSITY;
    fixtureDef.friction = 0f;
    fixtureDef.restitution = 0.45f;
    body.createFixture(fixtureDef);
    circle.dispose();
    return body;
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:17,代码来源:WorldUtils.java

示例2: createStaticAttackBody

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
/**
 * Erzeugt automatisch einen Kreis als statischen Trigger.
 *
 * @see AttackHandler#createAttackFixture(Body, Shape)
 *
 * @param position der Mittelpunkt des Kreises
 * @param radius der Radius des Kreises
 */
public void createStaticAttackBody(Vector2 position, float radius)
{
    CircleShape circle = new CircleShape();

    circle.setPosition(new Vector2(position.x, position.y).scl(Physics.MPP));
    circle.setRadius(radius * Physics.MPP);

    BodyDef triggerDef = new BodyDef();
    triggerDef.type = BodyDef.BodyType.StaticBody;

    Body trigger = manager.getPhysicalWorld().createBody(triggerDef);

    createAttackFixture(trigger, circle);

    circle.dispose();
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:25,代码来源:AttackHandler.java

示例3: initBall

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
private void initBall() {
    float radius = 26;

    mBall = new Circle(0.f, 0.f, radius);

    mBallTextureRegion = new TextureRegion(new Texture(Gdx.files.internal("ball.png")));

    // create physics body
    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;
    bodyDef.position.set(mBall.x, mBall.y);

    CircleShape ballShape = new CircleShape();
    ballShape.setRadius(mBall.radius - 2.f);

    mBallBody = mWorld.createBody(bodyDef);
    mBallBody.setUserData(new BodyUserDate(BODY_USER_DATA_TYPE_BALL));
    Fixture fixture = mBallBody.createFixture(ballShape, 0.5f);
    fixture.setFriction(BALL_FRICTION_BASE);
    fixture.setRestitution(0.4f);

    ballShape.dispose();
}
 
开发者ID:tgobbens,项目名称:fluffybalance,代码行数:24,代码来源:Balanceball.java

示例4: Food

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Food(World world, float x, float y, int size, float toGive) {
	super(x, y);
	color = new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
	outline = Advio.instance.darker(color);
	BodyDef bd = new BodyDef();
	bd.type = BodyType.KinematicBody;
	bd.position.set(x, y);
	CircleShape shape = new CircleShape();
	shape.setRadius(size);
	FixtureDef fd = new FixtureDef();
	fd.density = 0.1f;
	fd.shape = shape;
	fd.friction = 0.1f;
	// fd.filter.groupIndex = Advio.GROUP_BEINGS;
	body = world.createBody(bd);
	body.createFixture(fd).setUserData(new UserData("food").add("toGive", toGive));
	shape.dispose();
}
 
开发者ID:lvivtotoro,项目名称:advio,代码行数:19,代码来源:Food.java

示例5: Player

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Player(World world, float x, float y) {
	super(x, y);
	this.world = world;
	this.graphicsSize = 10;
	color = new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
	outline = Advio.instance.darker(color);
	BodyDef bd = new BodyDef();
	bd.type = BodyType.DynamicBody;
	bd.position.set(x, y);
	CircleShape shape = new CircleShape();
	shape.setRadius(50);
	FixtureDef fd = new FixtureDef();
	fd.density = 0.0f;
	fd.shape = shape;
	fd.friction = 0.1f;
	body = world.createBody(bd);
	body.createFixture(fd).setUserData(new UserData("player"));
	shape.dispose();
	// size * 2.25f
}
 
开发者ID:lvivtotoro,项目名称:advio,代码行数:21,代码来源:Player.java

示例6: Enemy

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Enemy(World world, float x, float y, int size) {
	super(x, y);
	this.world = world;
	this.graphicsSize = 0.1f;
	color = new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
	outline = Advio.instance.darker(color);
	BodyDef bd = new BodyDef();
	bd.type = BodyType.DynamicBody;
	bd.position.set(x, y);
	CircleShape shape = new CircleShape();
	shape.setRadius(size);
	FixtureDef fd = new FixtureDef();
	fd.density = 0.0f;
	fd.shape = shape;
	fd.friction = 0.1f;
	body = world.createBody(bd);
	body.createFixture(fd).setUserData(new UserData("enemy").add("body", body));
	shape.dispose();
}
 
开发者ID:lvivtotoro,项目名称:advio,代码行数:20,代码来源:Enemy.java

示例7: Player

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Player (TextureRegion texture, float x, float y) {
	this.texture = texture;
	
	BodyDef ballD = new BodyDef();
	ballD.position.set(x, y);
	ballD.type = BodyType.DynamicBody;
	body = world.createBody(ballD);
	
	FixtureDef ballFD = new FixtureDef();
	ballShape = new CircleShape();
	ballShape.setRadius(BALL_WIDTH / 2);
	ballFD.shape = ballShape;
	ballFD.density = 1;
	ballFD.friction = 0;
	ballFD.restitution = 1;
	ballFD.filter.categoryBits = CATEGORY_PLAYER;
	ballFD.filter.maskBits = MASK_PLAYER;
	body.createFixture(ballFD);
	
	ballShape.dispose();
}
 
开发者ID:zozotintin,项目名称:Dodgy-Dot,代码行数:22,代码来源:GameScreen.java

示例8: createCircle

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public static Body createCircle() {
	if (!BodyFactory.initialized) {
		throw new IllegalStateException("You must initialize BodyFactory before using its functions");
	}
	final BodyDef testBodyDef2 = new BodyDef();
	testBodyDef2.position.set(2, 3);
	testBodyDef2.type = BodyDef.BodyType.DynamicBody;
	testBodyDef2.fixedRotation = true;
	final Body body2 = BodyFactory.world.createBody(testBodyDef2);
	final CircleShape testShape2 = new CircleShape();
	testShape2.setRadius(1f);
	final FixtureDef testFixtureDef2 = new FixtureDef();
	testFixtureDef2.shape = testShape2;
	testFixtureDef2.density = 25f;
	testFixtureDef2.friction = 1f;
	testFixtureDef2.restitution = 0;
	body2.createFixture(testFixtureDef2);
	final MassData md = body2.getMassData();
	md.mass = 80; // kg
	body2.setMassData(md);
	// System.out.println("circle - mass: " + body2.getMassData().mass + " density: " + body2.getFixtureList().get(0).getDensity());
	testShape2.dispose();
	return body2;
}
 
开发者ID:TheElk205,项目名称:KillTheNerd,代码行数:25,代码来源:BodyFactory.java

示例9: Ball

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Ball(World world, float x, float y) {
	
	BodyDef bodyDef = new BodyDef();
	FixtureDef fixtureDef = new FixtureDef();
	this.world = world;
	
	// body definition
	bodyDef.type = BodyType.DynamicBody;
	bodyDef.position.set(x, y);

	// ball shape
	CircleShape ballShape = new CircleShape();
	ballShape.setRadius(RADIUS);

	// fixture definition
	fixtureDef.shape = ballShape;
	fixtureDef.friction = 0;
	fixtureDef.restitution = 1;
	//fixtureDef.density = 0;
	
	body = world.createBody(bodyDef);
	fixture = body.createFixture(fixtureDef);
	
	ballShape.dispose();
}
 
开发者ID:CODA-Masters,项目名称:Pong-Tutorial,代码行数:26,代码来源:Ball.java

示例10: createEllipse

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
/**
 * 
 * @param world
 * @param ellipseObject
 * @param density
 * @param friction
 * @param restitution
 */
private void createEllipse(World world, EllipseMapObject ellipseObject, float density, float friction, float restitution){
	Ellipse circle = ellipseObject.getEllipse();
	CircleShape shape = new CircleShape();
	shape.setRadius(circle.width / 2f / SupaBox.PPM);
	
	BodyDef bodyDef = new BodyDef();
	bodyDef.type = BodyType.StaticBody;
	bodyDef.position.set(new Vector2((circle.x + circle.width / 2f) / SupaBox.PPM, (circle.y + circle.width / 2f) / SupaBox.PPM));
	
	Body body = world.createBody(bodyDef);
	
	FixtureDef fixtureDef = new FixtureDef();
	fixtureDef.shape = shape;
	fixtureDef.density = density;
	fixtureDef.friction = friction;
	fixtureDef.restitution = restitution;
	
	body.createFixture(fixtureDef);
	
	shape.dispose();
}
 
开发者ID:ryanshappell,项目名称:SupaBax,代码行数:30,代码来源:BodyBuilder.java

示例11: Ball

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Ball(World world, float x, float y) {
	
	BodyDef bodyDef = new BodyDef();
	FixtureDef fixtureDef = new FixtureDef();
	this.world = world;
	
	// body definition
	bodyDef.type = BodyType.DynamicBody;
	bodyDef.position.set(x, y);

	// ball shape
	CircleShape ballShape = new CircleShape();
	ballShape.setRadius(RADIUS);

	// fixture definition
	fixtureDef.shape = ballShape;
	fixtureDef.friction = .25f;
	fixtureDef.restitution = 0.9f;
	fixtureDef.density = 2.5f;
	
	body = world.createBody(bodyDef);
	fixture = body.createFixture(fixtureDef);
	
	ballShape.dispose();
}
 
开发者ID:CODA-Masters,项目名称:Little-Nibolas,代码行数:26,代码来源:Ball.java

示例12: Escudo

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public Escudo(World world, ScreenRome pantalla, float x, float y, float width, float height) {
	WIDTH = width;
	HEIGHT = width * 2;
	this.world = world;
	this.pantalla = pantalla;
	
	BodyDef bodyDef = new BodyDef();
	bodyDef.type = BodyType.StaticBody;
	bodyDef.position.set(x, y);
	bodyDef.fixedRotation = true;
			
	CircleShape shape = new CircleShape();
	shape.setRadius(width/2);
	
	FixtureDef fixtureDef = new FixtureDef();
	fixtureDef.shape = shape;
	fixtureDef.friction = .5f;
	fixtureDef.restitution = 0;
	fixtureDef.density = 2.5f;
					
	body = world.createBody(bodyDef);
	fixture = body.createFixture(fixtureDef);
	
	shape.dispose();
			
}
 
开发者ID:CODA-Masters,项目名称:Little-Nibolas,代码行数:27,代码来源:Escudo.java

示例13: createPlayer

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
private Body createPlayer () {
	BodyDef def = new BodyDef();
	def.type = BodyType.DynamicBody;
	Body box = world.createBody(def);

	PolygonShape poly = new PolygonShape();
	poly.setAsBox(0.45f, 1.4f);
	playerPhysicsFixture = box.createFixture(poly, 1);
	poly.dispose();

	CircleShape circle = new CircleShape();
	circle.setRadius(0.45f);
	circle.setPosition(new Vector2(0, -1.4f));
	playerSensorFixture = box.createFixture(circle, 0);
	circle.dispose();

	box.setBullet(true);

	return box;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:21,代码来源:Box2DCharacterControllerTest.java

示例14: initBodies

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
@Override
protected void initBodies(PointF worldPos) {

    // Cuerpo
    {
        // Create Shape with Properties
        CircleShape circleShape = new CircleShape();
        circleShape.setRadius(mRadius);
        mMainBody = getWorld().createBody(this, worldPos, true);
        mMainBody.setBullet(true);

        // Assign shape to Body
        Fixture f = mMainBody.createFixture(circleShape, 1.0f);
        f.setFilterData(CONTACT_FILTER);
        circleShape.dispose();

    }

    mAnthtopoDelegate.createAnthropomorphicLimbs(worldPos, mRadius);
}
 
开发者ID:sergiotorresperez,项目名称:jumplings,代码行数:21,代码来源:IntroActor.java

示例15: initBodies

import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
@Override
protected void initBodies(PointF worldPos) {

    // Cuerpo
    {
        // Create Shape with Properties
        CircleShape circleShape = new CircleShape();
        circleShape.setRadius(mRadius);
        mMainBody = getWorld().createBody(this, worldPos, true);
        mMainBody.setBullet(true);

        // Assign shape to Body
        Fixture f = mMainBody.createFixture(circleShape, 1.0f);
        f.setFilterData(SPARKS_FILTER);
        circleShape.dispose();
    }

}
 
开发者ID:sergiotorresperez,项目名称:jumplings,代码行数:19,代码来源:SparksActor.java


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