use of org.jbox2d.dynamics.World in project Bytecoder by mirkosertic.
the class JBox2DTest method testNewWorld2.
@Test
public void testNewWorld2() {
World world = new World(new Vec2(0, -9.8f));
Assert.assertFalse(world.isLocked());
}
use of org.jbox2d.dynamics.World in project Bytecoder by mirkosertic.
the class JBox2DTest method testNewWorld.
@Test
public void testNewWorld() {
World world = new World(new Vec2(0, -9.8f));
BodyDef axisDef = new BodyDef();
axisDef.type = BodyType.STATIC;
axisDef.position = new Vec2(3, 3);
Body axis = world.createBody(axisDef);
CircleShape axisShape = new CircleShape();
axisShape.setRadius(0.02f);
axisShape.m_p.set(0, 0);
// FixtureDef axisFixture = new FixtureDef();
// axisFixture.shape = axisShape;
// axis.createFixture(axisFixture);
}
use of org.jbox2d.dynamics.World in project HackerHop by nicovank.
the class PlatformTest method distanceTest.
@Test
void distanceTest() {
World world = new World(new Vec2(0, -50));
float x1 = 10;
float y1 = 20;
float x2 = 30;
float y2 = 40;
Platform b = new Platform(x2, y2, world);
Platform a = new Platform(x1, y1, world);
double distance = Math.sqrt(Math.pow((30 - 10), 2) + Math.pow((40 - 20), 2));
assertEquals(distance, b.distanceTo(a));
}
use of org.jbox2d.dynamics.World in project HackerHop by nicovank.
the class PlayerTest method withinBoundsWhenGameStartsTest.
@Test
void withinBoundsWhenGameStartsTest() {
World world = new World(new Vec2(0, -50));
Vec2 position = new Vec2(0, 10);
Player p = new Player(world, position);
float x = p.getBody().getPosition().x;
float y = p.getBody().getPosition().y;
assertTrue(x >= 0 && x <= 54);
assertTrue(y >= 0 && y <= 72);
}
use of org.jbox2d.dynamics.World in project HackerHop by nicovank.
the class PlayerTest method characterTest.
// testing player character
@Test
void characterTest() {
World world = new World(new Vec2(0, -50));
Vec2 position = new Vec2(0, 10);
Character character = Character.ROB;
Player p = new Player(world, position, character);
assertSame(p.getCharacter(), character.ROB);
}
Aggregations