hey, you did a great job !
but unfortunately we have always garbage collector ...
i can't imagine making a game now with physics :'( .
But we are in the good path !





public int timeStep = (1000 / targetFPS); public float timeStep = (1.0f / targetFPS); 
World.create() {
worldAABB = new AABB();
// Step 2: Create Physics World with Gravity
Vec2 gravity = new Vec2((float) 0.0, (float) -10.0);
boolean doSleep = true;
world = new World(worldAABB, gravity, doSleep);
groundBodyDef = new BodyDef();
groundBodyDef.position.set(new Vec2((float) 0.0, (float) -10.0));
Body groundBody = world.createBody(groundBodyDef);
groundShapeDef = new PolygonDef();
groundShapeDef.setAsBox((float) 50.0, (float) 10.0);
groundBody.createShape(groundShapeDef);
}
public void addBall(float x, float y) {
// Create Dynamic Body
BodyDef bodyDef = new BodyDef();
bodyDef.position.set(x, WORLD_H - y);
Body newBody = world.createBody(bodyDef);
// Create Shape with Properties
CircleDef circle = new CircleDef();
circle.radius = (float) 1.8;
circle.density = (float) 1.0;
// Assign shape to Body
newBody.createShape(circle);
newBody.setMassFromShapes();
myBodies.add(newBody);
// Increase Counter
count += 1;
}


Users browsing this forum: No registered users and 6 guests