public void update(float delta) {
        for (GameObject g: gameObjects) {
            // update velocity
            g.getVelocity().add(new Vector2(g.getAcceleration().mul(delta)));
            if (g.getVelocity().len2() > g.getMaxVelocity2())
                g.getVelocity().div(g.getVelocity().len()).mul(g.getMaxSpeed());

            g.setPosition(g.getX() + g.getVelocity().x * delta, g.getY() + g.getVelocity().y * delta);

            // collisions
            for (int i = 0; i < gameObjects.size; i++) {
                GameObject iobj = gameObjects.get(i);
                for (int j = i + 1; j < gameObjects.size; j++) {
                    GameObject jobj = gameObjects.get(j);
                    if (iobj.canCollide(jobj) && jobj.canCollide(iobj) && GameObject.collideRect(iobj, jobj)) {
                        iobj.collide(jobj);
                        jobj.collide(iobj);
                    }
                }
            }

            g.update(delta);

            if (g.isRemove())
                removeGameObject(g);
        }
    }