e.addToWorld();
return e;
}
public static Entity createBullet(World world, float x, float y, float angle, Entity shooter) {
Entity e = world.createEntity();
world.getManager(GroupManager.class).add(e, "bullets");
Transform transform = new Transform(x, y, angle);
e.addComponent(transform);
e.addComponent(new SpatialForm("bullet"));
e.addComponent(new Expiration(1500));
Body b = new Body(new Box(10, 10), 0.2f);
b.setUserData(e);
b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
b.setBitmask(1);
b.setPosition(x, y);
b.setRestitution(0);
b.setDamping(0.002f);
b.setFriction(10);
b.setRotation(angle);
// b.setForce(10000f*TrigLUT.cosDeg(angle),
// 10000f*TrigLUT.sinDeg(angle));
b.adjustVelocity(new Vector2f(1000f * TrigLUT.cosDeg(angle), 1000f * TrigLUT.sinDeg(angle)));
// b.setDensity(100);
// b.setFriction(1.1f);
// b.setDamping(0.002f);
// b.setRestitution(0);
e.addComponent(new Physics(b));
e.addToWorld();
return e;
}