@Override
	public void onUpdate(float delta) {

		percentComplete += 100 * delta / waitTime;
		if (percentComplete > 100) {

			percentComplete = 100;
			Activity.stopCurrentActivity();

			try {
				level.load(null);
			} catch (IOException e) {
				e.printStackTrace();
			}
			Material material = new Material();
			material.setModelGenerator(new SimpleModelGenerator());
			MaterialEntity entity = new MaterialEntity();
			entity.setLevel(level);
			entity.setMaterial(material);
			Vec2[] verts = {
					new Vec2(-1, -1),
					new Vec2(1, -1),
					new Vec2(1, 1),
					new Vec2(-1, 1)};
			entity.setShape(verts);
			BodyDef objectDef = new BodyDef();
			objectDef.setType(BodyType.DYNAMIC);
			Body body = entity.setPhysicsObject(objectDef);

			for (Shape shape : shapeFromPolygon(verts)) {
				FixtureDef fixture = new FixtureDef();
				fixture.setFriction(0.5f);
				fixture.setRestitution(0.15f);
				fixture.setDensity(1);
				fixture.setShape(shape);
				body.createFixture(fixture);
			}
			entity.setLayer(1, 1);

			Entity player = new Entity();
			PlayerController controller = new PlatformerPlayerController();
			controller.setPawn(player);
			level.players.add(controller);
			player.setLevel(level);
			Vec2[] playerVertices = {
					new Vec2(-0.35f, 0),
					new Vec2(0.35f, 0),
					new Vec2(0.35f, 1.8f),
					new Vec2(-0.35f, 1.8f)};
			objectDef = new BodyDef();
			objectDef.setType(BodyType.DYNAMIC);
			Body playerObject = player.setPhysicsObject(objectDef);
			for (Shape shape : shapeFromPolygon(playerVertices))
				playerObject.createFixture(shape, 0);
			Mat4 transform = Mat4.identity();
			Transform.setPosition(transform, new Vec3(-3, 0, 0));
			player.setTransform(transform);

			//lambda expressions make this pretty
			ResourceManager.getResource(
					"Player.obj",
					loadedResource -> player.setModel((ModelLoader) loadedResource),
					ModelLoader.class);

			Entity button = new Entity();
			button.setLevel(level);
			Vec2[] buttonVertices = {
					new Vec2(-0.5f, 0),
					new Vec2(0.5f, 0),
					new Vec2(0.5f, 0.175f),
					new Vec2(-0.5f, 0.175f)};
			objectDef = new BodyDef();
			objectDef.setType(BodyType.DYNAMIC);
			Body buttonObject = button.setPhysicsObject(objectDef);
			for (Shape shape : shapeFromPolygon(buttonVertices)) {
				FixtureDef fixture = new FixtureDef();
				fixture.setFriction(10f);
				fixture.setDensity(1);
				fixture.setShape(shape);
				buttonObject.createFixture(fixture);
			}
			transform = Mat4.identity();
			Transform.setPosition(transform, new Vec3(3, 0, 0));
			button.setTransform(transform);

			ResourceManager.getResource(
					"button.obj",
					model -> button.setModel((ModelLoader) model),
					ModelLoader.class);

			ResourceManager.getResource(
					"button.png",
					image -> {
						button.getModel().texture = (Texture) image;
						button.getModel().setUserData(null);
					},
					Texture.class);
		}
		loadingText.setText(String.format(loadingMessage, (int) percentComplete));
	}