List of usage examples for com.badlogic.gdx.math Vector2 Y
Vector2 Y
To view the source code for com.badlogic.gdx.math Vector2 Y.
Click Source Link
From source file:de.cwclan.gdxtest.core.entities.Car.java
public Car(World world, FixtureDef chassisFixtureDef, FixtureDef wheelFixtureDef, float x, float y, float width, float height) { this.world = world; BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(x, y);//from ww w . j a va 2 s. co m //chassis PolygonShape chassisShape = new PolygonShape(); chassisShape.set(new float[] { -width / 2, -height / 2, width / 2, -height / 2, width / 2 * .4f, height / 2, -width / 2 * .8f, height / 2 * .8f }); chassisFixtureDef.shape = chassisShape; chassis = world.createBody(bodyDef); chassis.createFixture(chassisFixtureDef); CircleShape wheelShape = new CircleShape(); wheelShape.setRadius(height / 3.5f); wheelFixtureDef.shape = wheelShape; //left wheel leftWheel = world.createBody(bodyDef); leftWheel.createFixture(wheelFixtureDef); //right wheel rightWheel = world.createBody(bodyDef); rightWheel.createFixture(wheelFixtureDef); //left axis WheelJointDef axisDef = new WheelJointDef(); axisDef.bodyA = chassis; axisDef.bodyB = leftWheel; axisDef.localAnchorA.set(-width / 2 * .75f + wheelShape.getRadius(), -height / 2 * 1.25f); axisDef.frequencyHz = chassisFixtureDef.density; axisDef.localAxisA.set(Vector2.Y); axisDef.maxMotorTorque = chassisFixtureDef.density * 10; leftAxis = (WheelJoint) world.createJoint(axisDef); //right axis axisDef.bodyB = rightWheel; axisDef.localAnchorA.x *= -1; rightAxis = (WheelJoint) world.createJoint(axisDef); }
From source file:vault.clockwork.actors.HandActor.java
License:Open Source License
/** * Ctor./*from ww w . jav a 2s. c o m*/ * @param id Unique actor ID */ public HandActor(int id) { super(id, TYPE_PLAYER); // create hand sprite sprHand = new Sprite(Game.assets.get(HAND_TEXTURE, Texture.class)); sprHand.setOrigin(270.f, 94.f); sprHand.setScale(.8f); setPosition(Vector2.Y.cpy().scl(200.f)); // create stamina bar sprites sprStaminaBG = new Sprite(Game.assets.get(STAMINABAR_BG_TEXTURE, Texture.class)); sprStaminaFG = new Sprite(Game.assets.get(STAMINABAR_FG_TEXTURE, Texture.class)); sprStaminaMD = new Sprite(Game.assets.get(STAMINABAR_MD_TEXTURE, Texture.class)); // zmien stan rozgrywki setState(STATE_READY); }