Пример #1
0
  protected GameState updateThis(float et) {
    music.update(et);
    factory.update(et, player.getSpeed());
    field.update(et);
    tunnel.update(et);
    float offset = -getNearClippingPlane() - player.getL() / 2;
    totalDistance += -player.getZ() + offset;
    distortion.translateZ(player, offset, player.getSpeed());
    tunnel.translateZ(player, offset);
    field.translateZ(player, offset);

    if (player.isAlive()) {
      return this;
    } else if (fadeOut > 0) {
      fadeOut -= FADE_OUT_RATE * et;
      return this;
    } else {
      // TODO: Better end-of-game
      System.out.println("Game over!");
      System.out.println("Your score: " + score);
      System.out.println("Your speed: " + player.getSpeed());
      System.out.println("Your distance: " + totalDistance);
      return null;
    }
  }
Пример #2
0
 public Tunnelblick(GameManager man) {
   this.man = man;
   player = new Player(this);
   field.add(player);
   music = new MusicPlayer(distortion);
   man.getAudioPlayer().addSource(music, (short) 0x7FFF);
 }
Пример #3
0
 protected void drawThis(GL2 gl) {
   gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
   configureGL(gl);
   tunnel.draw(gl, distortion);
   field.draw(gl);
 }