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


Java BodyDef.BodyType方法代码示例

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


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

示例1: createEntityBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
/**
 * Erlaubt es den Unterklassen möglichst einfach einen beliebigen Box2D Körper zu erstellen.
 *
 * @param position die Startposition des Body
 * @param shape die Form, die für dne Body verwendet werden soll
 * @param type der Typ des Körpers
 * @return ein Box2D Körper
 */
protected Body createEntityBody(Vector2 position, Shape shape, BodyDef.BodyType type)
{
    position.scl(Physics.MPP);

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = type;
    bodyDef.position.set(position);
    bodyDef.fixedRotation = true;

    Body body = worldObjectManager.getPhysicalWorld().createBody(bodyDef);
    body.setUserData(this);

    FixtureDef fixture = new FixtureDef();
    fixture.shape = shape;
    fixture.filter.categoryBits = Physics.CATEGORY_ENTITIES;
    fixture.filter.maskBits = Physics.MASK_ENTITIES;

    body.createFixture(fixture).setUserData(this);

    shape.dispose();

    return body;
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:32,代码来源:BaseEntity.java

示例2: createGameObjectWithBox2DBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static GameObject createGameObjectWithBox2DBody(Vector2 gameObjectPos, Texture texture, Vector3 densityFrictionRestitution,
                                   BodyDef.BodyType bodyType, Shape.Type shapeType,
                                   World world) {
    GameObject gameObject = new GameObject();
    gameObject.setPosition(gameObjectPos.x, gameObjectPos.y);
    gameObject.setTexture(texture);
    gameObject.setSprite(new Sprite(texture));
    gameObject.getSprite().setOriginCenter();
    gameObject.setWorld(world);
    BodyCreator bodyCreator = new BodyCreator();
    gameObject.setBody(bodyCreator.createBody(new Vector2(gameObject.getX(), gameObject.getY()), texture, bodyType, world, shapeType, densityFrictionRestitution));
    bodyCreator = null;
    return gameObject;
}
 
开发者ID:hypeofpipe,项目名称:Race99,代码行数:15,代码来源:GameObjectFactory.java

示例3: createBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public Body createBody(Vector2 position, Texture texture, BodyDef.BodyType bodyType, World world, Shape.Type shape, Vector3 densityRestitutionFriction) {
    this.texture = texture;
    bodyDef = createBodyDef(bodyType, position);
    body = world.createBody(bodyDef);
    FixtureCreator.createFixture(body, createShape(shape), densityRestitutionFriction);
    return body;
}
 
开发者ID:hypeofpipe,项目名称:Race99,代码行数:8,代码来源:BodyCreator.java

示例4: boxBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static Body boxBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float thickness,float density, float friction, float restitution,boolean isSensor){
	Body b = world.createBody(bodyDef(type,position));
	PolygonShape s = new PolygonShape();
	            
	FixtureDef fd = fixtureDef(density,friction,restitution,s,isSensor);
	//top
	s.setAsBox(dimensions.x, thickness, new Vector2(position.x,position.y + dimensions.y), 0);
	fd.shape = s;
	b.createFixture(fd);
	
	//Bottom
	s.setAsBox(dimensions.x, thickness, new Vector2(position.x,position.y - dimensions.y), 0);
	fd.shape = s;
	b.createFixture(fd);
	
	//Left
	s.setAsBox(thickness, dimensions.y, new Vector2(position.x - dimensions.x,position.y), 0);
	fd.shape = s;
	b.createFixture(fd);
	
	//Right
	s.setAsBox(thickness, dimensions.y, new Vector2(position.x + dimensions.x,position.y), 0);
	fd.shape = s;
	b.createFixture(fd);
	
	s.dispose();
	
	return b;
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:30,代码来源:Box2dHelper.java

示例5: createBodyDef

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
private BodyDef createBodyDef(BodyDef.BodyType bodyType, Vector2 position) {
    BodyDef bodyDef_ = new BodyDef();
    bodyDef_.type = bodyType;
    bodyDef_.position.set(position);
    return bodyDef_;
}
 
开发者ID:hypeofpipe,项目名称:Race99,代码行数:7,代码来源:BodyCreator.java

示例6: getBodyType

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public BodyDef.BodyType getBodyType() {
    return bodyDef.type;
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:4,代码来源:EntityDefinition.java

示例7: getBodyType

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
@Override
protected BodyDef.BodyType getBodyType() {
    return BodyDef.BodyType.DynamicBody;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:5,代码来源:Item.java

示例8: getBodyType

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
protected BodyDef.BodyType getBodyType() {
    return BodyDef.BodyType.StaticBody;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:4,代码来源:PhysicalWorldObject.java

示例9: getBodyType

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
@Override
protected BodyDef.BodyType getBodyType() {
    return BodyDef.BodyType.KinematicBody;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:5,代码来源:Player.java

示例10: bodyDef

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static BodyDef bodyDef(BodyDef.BodyType type, Vector2 position){
	BodyDef bd = new BodyDef();
	bd.type = type;
	bd.position.set(position);
	return bd;
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:7,代码来源:Box2dHelper.java

示例11: circleBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static Body circleBody(World world, BodyDef.BodyType type, Vector2 position, float radius, float density,float friction,float restitution,boolean isSensor){
	Body b = world.createBody(bodyDef(type,position));
	circleFixture(b,radius,density,friction,restitution,isSensor);
	return b;
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:6,代码来源:Box2dHelper.java

示例12: rectangleBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static Body rectangleBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float density,float friction, float restitution,boolean isSensor){
	Body b = world.createBody(bodyDef(type,position));
	rectangleFixture(b,dimensions,density,friction,restitution,isSensor);
	return b;
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:6,代码来源:Box2dHelper.java

示例13: triangleBody

import com.badlogic.gdx.physics.box2d.BodyDef; //导入方法依赖的package包/类
public static Body triangleBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float density,float friction, float restitution,boolean isSensor){
	Body b = world.createBody(bodyDef(type,position));
	triangleFixture(b,dimensions,density,friction,restitution,isSensor);
	return b;
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:6,代码来源:Box2dHelper.java


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