Esempio n. 1
0
 @Override
 public void renderForeground(SpriteBatch batch) {
   floor.render(batch);
   fgRoots1.render(batch);
   fgRoots2.render(batch);
   renderDoorLight(batch);
 }
Esempio n. 2
0
  private void renderShrine(ShapeRenderer shapes, SpriteBatch batch) {
    batch.end();

    // 2. clear our depth buffer with 1.0
    Gdx.gl.glClearDepthf(1f);
    Gdx.gl.glClear(GL20.GL_DEPTH_BUFFER_BIT);

    // 3. set the function to LESS
    Gdx.gl.glDepthFunc(GL20.GL_LESS);

    // 4. enable depth writing
    Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);

    // 5. Enable depth writing, disable RGBA color writing
    Gdx.gl.glDepthMask(true);
    Gdx.gl.glColorMask(false, false, false, false);

    // 6. render your primitive shapes
    shapes.begin(ShapeType.Filled);

    // TODO: remove setColor if not needed.
    shapes.setColor(1f, 0f, 0f, 0.5f);
    // shapes.circle(200, 200, 100);
    shapes.setColor(0f, 1f, 0f, 0.5f);
    // shapes.rect(200, 200, 100, 100);
    shapes.rect(-300, 0, 600, 500);

    shapes.rect(100, 100, 100, 100);

    shapes.end();

    batch.begin();
    // 8. Enable RGBA color writing
    //   (SpriteBatch.begin() will disable depth mask)
    Gdx.gl.glColorMask(true, true, true, true);

    // 9. Make sure testing is enabled.
    Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);

    // 10. Now depth discards pixels outside our masked shapes
    Gdx.gl.glDepthFunc(GL20.GL_EQUAL);

    shrineOff.render(batch);
    shrineOn.setAlpha(shrineGlowAlpha);
    shrineOn.render(batch);

    batch.end();
    Gdx.gl.glDepthFunc(GL20.GL_ALWAYS);
    batch.begin();
  }
Esempio n. 3
0
  public NewGameOpening() {
    leftTorch = new StaticGraphicObject(Assets.openingTorch, -217, 349);
    // TODO: offset phase of animation.
    rightTorch =
        new StaticGraphicObject(Assets.openingTorch, 217, 349) {
          @Override
          public void render(Batch batch) {
            Sprite s = getSprite();
            s.setFlip(true, false);
            Utils.drawCenter(batch, s, position_.x, position_.y);
          }
        };

    bossAngryGlow.setAlpha(0);
    bossAngryGlowAdd.setAlpha(0);

    bossAwake.setAlpha(0);
  }
Esempio n. 4
0
  private void renderBossEyes(SpriteBatch batch) {
    if (bossStateTime > 7) {
      bossStateTime -= 7;
    }

    float alpha = 0;
    if (bossStateTime < 4) {
      if (relicTaken) bossStateTime = 0;
      alpha = 0;
    } else if (bossStateTime < 4.333f) {
      alpha = (bossStateTime - 4) / 0.333f;
    } else if (bossStateTime < 7f) {
      alpha = 1 - (bossStateTime - 4.333f) / 2.667f;
    }

    bossSleepsGlow.setAlpha(alpha);
    bossSleepsGlow.render(batch);
  }
Esempio n. 5
0
 @Override
 public void invoke(float t) {
   bossAngryGlowAdd.setAlpha(1 - t);
 }
Esempio n. 6
0
 @Override
 public void renderTop(SpriteBatch batch) {
   door.render(batch);
 }
Esempio n. 7
0
  @Override
  public void render(ShapeRenderer shapes, SpriteBatch batch) {

    bossSleeps.render(batch);
    renderBossEyes(batch);
    bossSleepsGlow.render(batch);

    bossAngryGlow.render(batch);
    bossAngryGlowAdd.render(batch);
    bossAwake.render(batch);
    bossSleepsRoots.render(batch);

    renderShrine(shapes, batch);

    door_back.render(batch);
    leftTorch.render(batch);
    rightTorch.render(batch);

    BatchUtils.setBlendFuncAdd(batch);

    leftTorchFire.setTint(shrineGlowAlpha);
    leftTorchFire.render(batch);
    leftTorchGlow.setTint((shrineGlowAlpha) * (doorLightScale - (float) Math.random() * 0.1f));
    leftTorchGlow.render(batch);

    rightTorchFire.setTint(shrineGlowAlpha);
    rightTorchFire.render(batch);
    rightTorchGlow.setTint((shrineGlowAlpha) * (doorLightScale - (float) Math.random() * 0.1f));
    rightTorchGlow.render(batch);
    BatchUtils.setBlendFuncNormal(batch);
  }