updateCounter();
spawner = new Entity();
spawner.transform.position.y = 15.0f;
spawner.addBehavior(new Behavior() {
private float timeUntilSpawn = 2.0f;
@Override
public void update() {
timeUntilSpawn -= Time.deltaTime();
if (timeUntilSpawn <= 0) {
float width = random.nextFloat() * 2.0f + 1.0f;
float height = random.nextFloat() * 2.0f + 1.0f;
float depth = random.nextFloat() * 2.0f + 1.0f;
final Entity entity = RigidBody.box(new Material(Color.random()), width, height, depth, 1.0f);
entity.addBehavior(new Behavior() {
@Override
public void update() {
if (entity.transform.position.y < -20.0f || isKeyDown(KEY_LCONTROL)) {
entity.destroy();
numBlocks--;