public void update() {
    if (index >= sequenceList.size()) {
      index = 0;
      reached = true;
      if (repeat != true) start = false;
    }

    manager.update(Gdx.graphics.getDeltaTime());

    if (reached == true) {
      struct = sequenceList.get(sequenceList.size() - 1);
      if (struct.animation.getRunningTweensCount() == 0 && manager.getRunningTweensCount() == 0) {
        ended = true;
      }
    }

    if (start == true) {
      // get the current element
      struct = sequenceList.get(index);

      // check if there is a previous element
      if (index - 1 != -1) {
        // get the previous element
        prevStruct = sequenceList.get(index - 1);
        inspectCommand();
      } else {
        // get the last element from the list
        prevStruct = sequenceList.get(sequenceList.size() - 1);
        inspectCommand();
      }
    }
  }
  @Override
  public void render(SpriteBatch sb) {
    delta = (TimeUtils.millis() - startTime + 700) / 1000;
    tweenManager.update(delta);
    bgManager.render(sb);

    sb.setProjectionMatrix(camera.combined);
    sb.begin();
    backButton.render(sb);
    randomCardButton.draw(sb);
    rareCardButton.draw(sb);

    Fonts.MFont.draw(
        sb, "Cost: " + randomCardCost, randomCardButton.getX(), randomCardButton.getY() - 40);
    Fonts.MFont.draw(
        sb, "Cost: " + rareCardCost, rareCardButton.getX(), rareCardButton.getY() - 40);

    Fonts.MFont.draw(
        sb,
        currGold,
        MainGame.WIDTH - Fonts.MFont.getBounds(currGold).width - 40,
        MainGame.HEIGHT - 50);

    if (showingCard) {
      sb.draw(alpha, 0, 0, MainGame.WIDTH, MainGame.HEIGHT);
      purchasedCard.render(
          new Vector2(
              MainGame.WIDTH / 2 - (Card.WIDTH / 2 * cardAnimSprite.getScaleX()),
              MainGame.HEIGHT / 2 - (Card.HEIGHT / 2 * cardAnimSprite.getScaleX())),
          cardAnimSprite.getScaleX(),
          sb);
      unlockedText.draw(sb);
    }
    sb.end();
  }
Example #3
0
  @Override
  public void render() {
    delta = Gdx.graphics.getDeltaTime() * 60;
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    player.update(delta);
    if (player.atLimit()) backgroundPos -= 20 * delta;
    else backgroundPos -= 10 * delta;

    if (backgroundPos <= -background.getHeight()) backgroundPos = 0;

    spriteBatch.setProjectionMatrix(camera.combined);
    spriteBatch.begin();
    spriteBatch.draw(background, -1080 / 2, +background.getHeight() / 2 + backgroundPos);
    spriteBatch.draw(background, -1080 / 2, -background.getHeight() / 2 + backgroundPos);
    player.draw(spriteBatch);
    enemies.update(spriteBatch, delta);
    tweenManager.update(delta / 60);
    spriteBatch.end();

    rayHandler.setCombinedMatrix(camera.combined);
    rayHandler.updateAndRender();

    controls.handleInput(camera);
  }
Example #4
0
  private void updatePhysics() {
    // Update
    // float deltaTime = Gdx.graphics.getRawDeltaTime();
    float deltaTime = 1 / 60f;
    // System.out.println(deltaTime);
    tweenManager.update(deltaTime); // Setting delta time
    world.step(deltaTime, 10, 10);

    Vector2 planetPos = planetModel.getPosition().sub(planetModelOrigin);
    planetSprite.setPosition(planetPos.x, planetPos.y);
    planetSprite.setOrigin(planetModelOrigin.x, planetModelOrigin.y);
    planetSprite.setRotation(planetModel.getAngle() * MathUtils.radiansToDegrees);

    Vector2 planetCorePos = planetCoreModel.getPosition().sub(planetCoreModelOrigin);
    planetCoreSprite.setPosition(planetCorePos.x, planetCorePos.y);
    planetCoreSprite.setOrigin(planetCoreModelOrigin.x, planetCoreModelOrigin.y);
    planetCoreSprite.setRotation(planetCoreModel.getAngle() * MathUtils.radiansToDegrees);

    for (int i = 0; i < MAX_BALLS; i++) {
      Vector2 ballPos = ballModels[i].getPosition();
      ballSprites[i].setPosition(
          ballPos.x - ballSprites[i].getWidth() / 2, ballPos.y - ballSprites[i].getHeight() / 2);
      ballSprites[i].setRotation(ballModels[i].getAngle() * MathUtils.radiansToDegrees);
    }
  }
 @Override
 public void render(float delta) {
   manager.update(delta);
   Gdx.gl.glClearColor(1, 1, 1, 1);
   Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   batcher.begin();
   sprite.draw(batcher);
   batcher.end();
 }
Example #6
0
  public void render(float delta) {

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();

    tweenManager.update(delta);
  }
Example #7
0
  /**
   * Update everything. Called by render()
   *
   * @param delta
   */
  private void update(float delta) {
    // Update normal camera.
    orthographicCamera.update();

    // Update tween engine.
    tweenManager.update(delta);

    // Update stage action.
    tappy.setStage(splashNormalStage);
    tappy.getStage().act();
  }
Example #8
0
  private void handleTipOverDrawing(SpriteBatch batch) {
    // Update once for playing tipping over
    if (updateTipOverSprite) {
      updateTipOverSprite = false;
      setPlayTippingOver();
    }

    // Oh no, not a uniform coding, will figure out the better coding style later
    if (tipOverStateTime > tipOverE.animationDuration) {
      tweenManager.update(Gdx.graphics.getDeltaTime());
      tipOverSprite.draw(batch);
    } else {
      drawTippingOver(batch);
    }
  }
Example #9
0
  private void restart() {

    float y = (HEIGHT_WORLD / 2) - 10;

    planetCoreModel.setTransform(0, y, 0);
    planetCoreModel.setLinearVelocity(0f, 0f);
    planetCoreModel.setAngularVelocity(1f);

    planetModel.setTransform(0, y, 0f);
    planetModel.setLinearVelocity(0f, 0f);
    planetModel.setAngularVelocity(1f);

    Vector2 vec = new Vector2();

    for (int i = 0; i < MAX_BALLS; i++) {
      float tx = rand.nextFloat() * 1.0f - 1f;
      float ty = HEIGHT_WORLD + BALL_RADIUS;
      float angle = rand.nextFloat() * MathUtils.PI * 2;

      ballModels[i].setActive(false);
      ballModels[i].setLinearVelocity(vec.set(0, -10));
      ballModels[i].setAngularVelocity(0f);
      ballModels[i].setTransform(vec.set(tx, ty), angle);
    }

    tweenManager.killAll();

    Tween.call(
            new TweenCallback() {
              private int idx = 0;

              @Override
              public void onEvent(int arg0, BaseTween<?> arg1) {
                if (idx < ballModels.length) {
                  ballModels[idx].setAwake(true);
                  ballModels[idx].setActive(true);
                  idx += 1;
                }
              }
            })
        .repeat(MAX_BALLS, 0.5f)
        .start(tweenManager);
  }
Example #10
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    logger.log();

    stage.draw();
    stage.act();
    stage.getRoot().getColor().a = 0f;

    batch.begin();

    font.draw(batch, stage.getCuvant().toUpperCase(), 15, 790);
    font.draw(batch, totalPointsStr, 420, 790);

    if (stage.eCuvant()) {
      font.setColor(Color.GREEN);
    }

    if (drawTween) {
      tweenFont.draw(batch, "+" + points, tweenFont.getX(), tweenFont.getY());
    }

    // playButton.setAlpha(0.5f);
    // batch.draw(playButton, 220, 750);

    batch.end();

    // draw the line
    shapeRend.begin(ShapeType.Line);
    shapeRend.setColor(Color.ORANGE);
    shapeRend.line(0, 745, 480, 745);
    shapeRend.end();

    manager.update(delta);

    showMenu();
  }
Example #11
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glClearColor(.3f, .3f, .3f, 1);

    simulateEventHandler(delta);

    if (!ready) {
      renderLoading(delta);
      return;
    }
    if (loading) {
      Tween.to(wrapper, PrimitiveTweenAccessor.FLOAT, .4f)
          .target(0)
          .ease(Linear.INOUT)
          .setCallback(
              (type, source) -> {
                if (type == TweenCallback.COMPLETE) {
                  stillLoading = false;
                }
              })
          .start(tweenManager);
      loading = false;
    }

    tweenManager.update(delta);

    preRender(delta);
    try {
      stage2d.act(delta);
      stage2d.draw();
    } catch (Exception ignored) {
    }
    postRender(delta);

    if (stillLoading) {
      renderLoading(delta);
    }
  }
  public void render() {
    tweenManager.update(Gdx.graphics.getDeltaTime());

    if (gdx.getRotation() > 360 * 15 - 20) gdx.setRegion(gdxTex);

    GLCommon gl = Gdx.gl;
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    strip.draw(batch);
    universal.draw(batch);
    tween.draw(batch);
    engine.draw(batch);
    logo.draw(batch);
    powered.draw(batch);
    gdx.draw(batch);
    if (veil.getColor().a > 0.1f) veil.draw(batch);
    batch.end();
  }
Example #13
0
  public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    Texture chipBg = new Texture(Gdx.files.internal("img/chips.png"));
    stage.addActor(new Image(chipBg));

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    table.bottom().right();

    backButton = new TextButton("BACK", skin);
    backButton.addListener(
        new ClickListener() {
          public void clicked(InputEvent event, float x, float y) {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new PotatoMenu());
          }
        });
    backButton.pad(10);

    table.add(backButton).bottom().right();
    ;

    stage.addActor(table);

    tweenManager = new TweenManager();
    Tween.registerAccessor(Actor.class, new ActorAccessor());

    tweenManager.update(Gdx.graphics.getDeltaTime());

    stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f)));
  }
Example #14
0
 private void hideBorder() {
   tweenManager.killTarget(borderThickness);
   Tween.to(SetCard.this, Accessor.BORDER_THICKNESS, 0.4f).target(2).start(tweenManager);
 }
Example #15
0
 @Override
 public void draw(Batch batch, float parentAlpha) {
   super.draw(batch, parentAlpha);
   setDebug(false);
   tweenManager.update(Gdx.graphics.getDeltaTime());
 }
 public void dispose() {
   tweenManager.killAll();
   batch.dispose();
 }