예제 #1
0
  public void draw(SpriteBatch batch) {
    batch.end();

    stage.getBatch().setProjectionMatrix(stage.getCamera().combined);
    if (eff != null) {
      if (lastHeroPositionX == 0) lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x;
      else {
        if (lastHeroPositionX != RPG.ctrl.hero.getHeadHero().position.x) {
          if (lastHeroPositionX > RPG.ctrl.hero.getHeadHero().position.x) { // LEFT
            eff.getEmitters().get(0).getVelocity().setHigh(500, 500);
          } else {
            eff.getEmitters().get(0).getVelocity().setHigh(-500, -500);
          }
        } else {
          eff.getEmitters().get(0).getVelocity().setHigh(0, 0);
        }
        lastHeroPositionX = (int) RPG.ctrl.hero.getHeadHero().position.x;
      }
      eff.setPosition(0, GameUtil.getScreenHeight());

      stage.getBatch().begin();
      eff.draw(stage.getBatch(), Gdx.graphics.getDeltaTime());
      stage.getBatch().end();

      if (eff.isComplete()) eff.reset();
    }

    batch.begin();
  }
예제 #2
0
  public void collect() {
    enterSound.stop();
    getSound.play(ESPGame.game.getSoundVolume() * 3.4f);

    getEffect.reset();
    getEffect.setPosition(position.x, position.y);
    ESPGame.getLevel().addParticleSystem(getEffect);

    remove();

    int r = 1, g = 1, b = 1;
    for (int i = 0; i < ADDITIONALREWARDEDDYS; i++) {
      switch (new Random().nextInt(3)) {
        case 0:
          r++;
          break;
        case 1:
          g++;
          break;
        case 2:
          b++;
          break;
        default:
          i--;
      }
    }
    ESPGame.getLevel().modReserve(0, r);
    ESPGame.getLevel().modReserve(1, g);
    ESPGame.getLevel().modReserve(2, b);

    TextDisplayer d =
        ESPGame.getLevel()
            .createTextDisplayer(
                getPosition(),
                VectorUtils.randomNormalized().scl(.5f),
                TEXTDURATION,
                "+" + r,
                Fontsize.Gross);
    d.setColor(Color.RED);
    d =
        ESPGame.getLevel()
            .createTextDisplayer(
                getPosition(),
                VectorUtils.randomNormalized().scl(.5f),
                TEXTDURATION,
                "+" + g,
                Fontsize.Gross);
    d.setColor(Color.GREEN);
    d =
        ESPGame.getLevel()
            .createTextDisplayer(
                getPosition(),
                VectorUtils.randomNormalized().scl(.5f),
                TEXTDURATION,
                "+" + b,
                Fontsize.Gross);
    d.setColor(Color.BLUE);
  }
예제 #3
0
  public void init(float x, float y, float tx, float ty) {
    position.set(x, y);
    start.set(position);
    target.set(tx, ty);
    effect.reset();
    duration = target.dst(position) / 6;
    active = true;
    light.setActive(true);
    light.setPosition(x, y);

    for (ParticleEmitter emitter : effect.getEmitters()) {
      emitter.setContinuous(true);
    }
  }
예제 #4
0
  // this method put all counters at 0.
  public static void setGame() {
    for (int i = 0; i < 18; i++) {
      RunningStorage.side_left[i].setState(0);
      RunningStorage.side_right[i].setState(1);
      RunningStorage.side_left[i].setPosition(
          -RunningStorage.side_left[i].spSpike.getWidth(),
          (float) (GeneralStorage.h - GeneralStorage.h * 0.1 - GeneralStorage.h * 0.05 * i));
      RunningStorage.side_right[i].setPosition(
          GeneralStorage.w,
          GeneralStorage.h - GeneralStorage.h * 0.1f - GeneralStorage.h * 0.05f * i); //
    }
    counter = 0;
    RunningStorage.changeState = false;
    MenuStorage.spBackGroundGame.setTexture(GeneralStorage.imgBackGround);
    MenuStorage.spBackGroundGame.setColor(colorFondo);
    RunningStorage.pointer = 0;
    RunningStorage.last_touched = 0;
    RunningStorage.array_aleatorios.clear();
    GeneralStorage.bird.spBird.setRotation(RunningStorage.posicion);
    GeneralStorage.bird.setVelocityY((float) (GeneralStorage.h * 0.10));
    GeneralStorage.bird.setDirection_x(1);
    GeneralStorage.bird.spBird.setTexture(GeneralStorage.bird.imgBirdDC);
    GeneralStorage.bird.setPosition(
        GeneralStorage.w / 2 - GeneralStorage.bird.getWidth() / 2,
        GeneralStorage.h / 2
            - GeneralStorage.bird.getHeight() / 2); // position on the middle screen
    GeneralStorage.bird.spBird.setColor(GeneralStorage.color);
    MenuStorage.HelpTouched = false;
    // here reset the particles to restart the game.
    particle1.reset();
    RunningUpDate.touchLeft = false;
    RunningUpDate.touchRight = false;

    if (GameOverUpDate.isReview) GeneralStorage.estado = GeneralStorage.state.menu;
    else GeneralStorage.estado = GeneralStorage.state.running;
    GameOverUpDate.isReview = false;
  }
예제 #5
0
 public void draw(SpriteBatch batch) {
   stage.draw();
   SpriteBatch sb = (SpriteBatch) stage.getBatch();
   sb.begin();
   FontUtil.draw(sb, item.name, 22, Color.WHITE, 455, 134, 1000);
   FontUtil.draw(sb, item.illustration, 18, Color.DARK_GRAY, 459, 100, 490);
   scuse.draw(sb);
   if (sellist.isVisible()) sellist.draw(sb, 1);
   scfor.draw(sb);
   if (herolist.isVisible()) {
     herolist.draw(sb, 1);
     sb.flush();
     if (herolist.getSelectedIndex() != -1
         && herolist.getSelected().userObject != null
         && !(herolist.getSelected().userObject instanceof Image)) {
       Hero h = ((Hero) herolist.getSelected().userObject);
       render.begin(ShapeType.Filled);
       render.setColor(green);
       render.rect(
           575, 142, (float) ((float) h.prop.get("hp") / (float) h.prop.get("maxhp")) * 176, 20);
       render.setColor(cblue);
       render.rect(
           575, 105, (float) ((float) h.prop.get("mp") / (float) h.prop.get("maxmp")) * 176, 20);
       render.end();
       FontUtil.draw(
           sb,
           h.prop.get("hp") + "/" + h.prop.get("maxhp"),
           16,
           blue,
           572
               + 176 / 2
               - FontUtil.getTextWidth(h.prop.get("hp") + "/" + h.prop.get("maxhp"), 20, -7) / 2,
           158,
           400,
           -5,
           0);
       FontUtil.draw(
           sb,
           h.prop.get("mp") + "/" + h.prop.get("maxmp"),
           16,
           blue,
           572
               + 176 / 2
               - FontUtil.getTextWidth(h.prop.get("mp") + "/" + h.prop.get("maxmp"), 20, -7) / 2,
           121,
           400,
           -5,
           0);
       FontUtil.draw(
           sb, "正常", 18, blue, 563 + 176 / 2 - FontUtil.getTextWidth("正常", 18) / 2, 196, 400);
       FontUtil.draw(sb, h.toString(), 18, Color.WHITE, 515, 227, 200);
       if (drawp) {
         add.draw(sb, Gdx.graphics.getDeltaTime());
         drawp = !add.isComplete();
       } else add.reset();
       sb.draw(h.images[1].getRegion(), 810, 97);
     }
     sb.flush();
   }
   if (group.isVisible()) {
     group.draw(batch, 1);
     String tmp = String.valueOf(currentCount);
     tmp = tmp.length() == 1 ? "00" + tmp : tmp.length() == 2 ? "0" + tmp : tmp;
     Image i1 = NumberUtil.get(tmp.substring(0, 1));
     i1.setPosition(390, 275);
     i1.draw(sb);
     Image i2 = NumberUtil.get(tmp.substring(1, 2));
     i2.setPosition(430, 275);
     i2.draw(sb);
     Image i3 = NumberUtil.get(tmp.substring(2, 3));
     i3.setPosition(470, 275);
     i3.draw(sb);
   }
   sb.end();
 }