Example #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();
  }
Example #2
0
 @Override
 public void update(float delta) {
   if (!active) return;
   timer += delta;
   float a = timer / duration;
   if (a <= 1) {
     position.x = Interpolation.linear.apply(start.x, target.x, a);
     position.y =
         Interpolation.linear.apply(start.y, target.y, a) + ((1 + MathUtils.sinDeg(a * 180)) * 2);
     light.setDistance(1.5f + MathUtils.random(-.25f, .25f));
   } else {
     effect.allowCompletion();
     for (ParticleEmitter emitter : effect.getEmitters()) {
       emitter.setContinuous(false);
     }
     light.setDistance(light.getDistance() * 0.95f);
   }
   light.setPosition(position);
   effect.setPosition(position.x, position.y);
   effect.update(delta);
   if (effect.isComplete()) {
     Gdx.app.log("", "reset");
     FlamingRock.pool.free(this);
   }
 }
Example #3
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();
 }