예제 #1
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);
  }
예제 #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();
  }
예제 #3
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);
  }
예제 #4
0
 @Override
 public void invoke(float t) {
   bossAngryGlowAdd.setAlpha(1 - t);
 }