コード例 #1
0
  private PauseScreen() {
    setSize(w, h);
    setPosition(Main.width / 2 - w / 2, Main.height / 2 - h / 2);
    int width = (w - TextBox.gap * 4) / 3;
    //		addTransitionButton("sound", SoundScreen.get(), (width+TextBox.gap)*0,0, width);
    //		addTransitionButton("clicking", GameScreen.get(), (width+TextBox.gap)*1,0, width);
    //		addTransitionButton("fonts", FontScreen.get(), (width+TextBox.gap)*2,0, width);

    int numScales = 4;
    width = (w - TextBox.gap * (numScales + 1)) / numScales;
    for (int i = 0; i < numScales; i++)
      addScaleButton(i + 1, (width + TextBox.gap) * i, TextBox.gap * 2, width);

    Slider.SFX.setPosition(w / 2 - Slider.SFX.getWidth() / 2, 40);
    addActor(Slider.SFX);

    Slider.music.setPosition(w / 2 - Slider.SFX.getWidth() / 2, 70);
    addActor(Slider.music);

    TextBox tb = new TextBox("Restart");
    tb.addClickAction(
        new Runnable() {
          @Override
          public void run() {
            Sounds.stopMusic();
            Main.self.setScreen(new StartScreen());
            Main.self.toggleMenu();
          }
        });
    tb.setPosition(getWidth() / 2, getHeight() - 20, Align.center);
    addActor(tb);

    //		Slider.music.setPosition(w/2-Slider.SFX.getWidth()/2, 60);
    //		addActor(Slider.music);
  }
コード例 #2
0
ファイル: Minion.java プロジェクト: ColourTann/aslotlodh2
  public void fight() {
    inRange = false;
    if (currentTarget != null) {
      targetPosition = currentTarget.position;
      if (position.dst(currentTarget.position) <= range) {
        inRange = true;

        if (secondsUntilShoot <= 0) {

          int multiplier = team == Team.Left ? -1 : 1;

          secondsUntilShoot = secondsPerShot * Particle.rand(.9f, 1.1f);
          switch (type) {
            case Melee:
              currentTarget.damage((int) damage);
              setRotation(.3f * multiplier);
              addAction(Actions.rotateTo(0, .2f));
              break;
            case Ranged:
              pop.play(Slider.SFX.getValue());
              GameScreen.self.addParticle(
                  new MinionShot((int) position.x, (int) position.y, currentTarget, (int) damage));
              setRotation(.3f * -multiplier);
              addAction(Actions.rotateTo(0, .2f));
              break;
            default:
              break;
          }
        }
        return;
      }
    } else {
      if (!player) targetPosition = defaultAttackPosition;
    }
  }
コード例 #3
0
ファイル: Minion.java プロジェクト: ColourTann/aslotlodh2
 @Override
 public void die() {
   death.play(Slider.SFX.getValue());
   untarget();
 }