コード例 #1
0
  @SuppressWarnings("null")
  public void draw(PolygonSpriteBatch batch, Skeleton skeleton) {
    boolean premultipliedAlpha = this.premultipliedAlpha;
    BlendMode blendMode = null;

    float[] vertices = null;
    short[] triangles = null;
    Array<Slot> drawOrder = skeleton.drawOrder;
    for (int i = 0, n = drawOrder.size; i < n; i++) {
      Slot slot = drawOrder.get(i);
      Attachment attachment = slot.attachment;
      Texture texture = null;
      if (attachment instanceof RegionAttachment) {
        RegionAttachment region = (RegionAttachment) attachment;
        vertices = region.updateWorldVertices(slot, premultipliedAlpha);
        triangles = quadTriangles;
        texture = region.getRegion().getTexture();

      } else if (attachment instanceof MeshAttachment) {
        MeshAttachment mesh = (MeshAttachment) attachment;
        vertices = mesh.updateWorldVertices(slot, premultipliedAlpha);
        triangles = mesh.getTriangles();
        texture = mesh.getRegion().getTexture();

      } else if (attachment instanceof SkeletonAttachment) {
        Skeleton attachmentSkeleton = ((SkeletonAttachment) attachment).getSkeleton();
        if (attachmentSkeleton == null) continue;
        Bone bone = slot.getBone();
        Bone rootBone = attachmentSkeleton.getRootBone();
        float oldScaleX = rootBone.getScaleX();
        float oldScaleY = rootBone.getScaleY();
        float oldRotation = rootBone.getRotation();
        attachmentSkeleton.setPosition(bone.getWorldX(), bone.getWorldY());
        // rootBone.setScaleX(1 + bone.getWorldScaleX() - oldScaleX);
        // rootBone.setScaleY(1 + bone.getWorldScaleY() - oldScaleY);
        // Set shear.
        rootBone.setRotation(oldRotation + bone.getWorldRotationX());
        attachmentSkeleton.updateWorldTransform();

        draw(batch, attachmentSkeleton);

        attachmentSkeleton.setPosition(0, 0);
        rootBone.setScaleX(oldScaleX);
        rootBone.setScaleY(oldScaleY);
        rootBone.setRotation(oldRotation);
      }

      if (texture != null) {
        BlendMode slotBlendMode = slot.data.getBlendMode();
        if (slotBlendMode != blendMode) {
          blendMode = slotBlendMode;
          batch.setBlendFunction(blendMode.getSource(premultipliedAlpha), blendMode.getDest());
        }
        batch.draw(texture, vertices, 0, vertices.length, triangles, 0, triangles.length);
      }
    }
  }
コード例 #2
0
  public IkConstraint(IkConstraintData data, Skeleton skeleton) {
    this.data = data;
    mix = data.mix;
    bendDirection = data.bendDirection;

    bones = new Array(data.bones.size);
    if (skeleton != null) {
      for (BoneData boneData : data.bones) bones.add(skeleton.findBone(boneData.name));
      target = skeleton.findBone(data.target.name);
    }
  }
コード例 #3
0
  @Override
  public void act(float delta) {
    super.act(delta);

    skeleton.setX(getX());
    skeleton.setY(getY());
    skeleton.getRootBone().setScaleX(getScaleX());
    skeleton.getRootBone().setScaleY(getScaleY());
    animationState.update(delta);
    animationState.apply(skeleton);
    skeleton.updateWorldTransform();
  }
コード例 #4
0
 public TransformConstraint(TransformConstraintData data, Skeleton skeleton) {
   if (data == null) throw new IllegalArgumentException("data cannot be null.");
   if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
   this.data = data;
   rotateMix = data.rotateMix;
   translateMix = data.translateMix;
   scaleMix = data.scaleMix;
   shearMix = data.shearMix;
   bones = new Array(data.bones.size);
   for (BoneData boneData : data.bones) bones.add(skeleton.findBone(boneData.name));
   target = skeleton.findBone(data.target.name);
 }
コード例 #5
0
  public Facebuttons(Everybodyloveskimchi g, String n) {
    this.game = g;
    this.assignedname = n;
    texture = new Texture(Gdx.files.internal("faceicons/" + n + ".png"));
    this.renderer = new SkeletonRenderer();
    renderer.setPremultipliedAlpha(true);
    this.atlas = new TextureAtlas(Gdx.files.internal("foodx.atlas"));
    SkeletonJson json = new SkeletonJson((TextureAtlas) atlas);
    json.setScale(0.7f);
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("foodx.json"));
    skeleton = new Skeleton(skeletonData);
    skeleton.setPosition(0, 0);
    skeleton.getRootBone().setScale(0.6f);
    AnimationStateData stateData = new AnimationStateData(skeletonData);
    state = new AnimationState(stateData);
    state.setTimeScale(0.5f);
    state.setAnimation(0, "idle", false);

    setAg();

    this.setBounds(0, 0, 98f, 106f);

    this.addListener(
        new InputListener() {
          @Override
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (enabled) {
              System.out.println(assignedname + "down");
              clickedY = -5f;
              game.members.get(assignedname).foodtoeat = game.currentFood;
              game.sendMemeber(assignedname);
              //          clickedY
              //            moveTo(0f,100f,10);
              //
            }
            return true;
          }

          @Override
          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            if (enabled) {
              System.out.println(assignedname + "up");
              clickedY = 0f;
              //            trip();
            }
          }
        });
  }
コード例 #6
0
ファイル: VisSpine.java プロジェクト: 4630599/VisEditor
  @VisInternal
  public void updateDefaultAnimations() {
    if (defaultAnimation == null)
      defaultAnimation = skeleton.getData().getAnimations().get(0).getName();

    if (playOnStart) state.setAnimation(0, defaultAnimation, true);
  }
コード例 #7
0
ファイル: VisSpine.java プロジェクト: 4630599/VisEditor
  private void init(SkeletonData skeletonData) {
    skeleton = new Skeleton(skeletonData);

    stateData = new AnimationStateData(skeletonData);
    state = new AnimationState(stateData);

    defaultAnimation = skeleton.getData().getAnimations().get(0).getName();
  }
コード例 #8
0
 public void update(float delta) {
   // we dont have an idle animation, so we just dont animate until we need to
   if (isExecuting) {
     animationState.update(delta);
     animationState.apply(skeleton);
     skeleton.updateWorldTransform();
   }
 }
コード例 #9
0
ファイル: Gamescreen.java プロジェクト: piotrekuczy/jwt2015
  public void updateTitle(float delta) {
    // System.out.println("update title");
    batch.begin();
    switch (level) {
      case 0:
        batch.draw(swiat00tlo, 0, 0);
        break;
      case 1:
        batch.draw(swiat01tlo, 0, 0);
        break;
      case 2:
        batch.draw(swiat02tlo, 0, 0);
        break;
      case 3:
        batch.draw(swiat03tlo, 0, 0);
        break;
    }
    // total power numbers
    font.draw(batch, "total: ", 35, 100);
    font.draw(batch, pulaGracza + "", 50, 70, 50, Align.center, false);
    font.draw(batch, "total: ", 1160, 100);
    font.draw(batch, pulaPrzeciwnika + "", 1175, 70, 50, Align.center, false);

    // actual hp
    font.draw(
        batch,
        game.player.playerHp + "",
        playerIcon.getX() - 25,
        playerIcon.getY() + 260,
        50,
        Align.center,
        false);

    if (enemys.size > 0) {
      font.draw(
          batch, enemys.peek().getHp() + "", enemys.peek().getX() - 15, enemys.peek().getY() + 260);
    }

    batch.end();
    // draw kotara
    batch.begin();
    kotaraState.update(Gdx.graphics.getDeltaTime());
    kotaraState.apply(kotaraSkeleton);
    kotaraSkeleton.updateWorldTransform();
    sr.draw(batch, kotaraSkeleton);
    batch.end();
    // sprawdz czy kotara sie odslonila
    if (kotaraState.getCurrent(0) == null) {
      currentState = GameState.MAP;
    }
    stage.act(delta);
    stage.draw();
  }
コード例 #10
0
ファイル: Gamescreen.java プロジェクト: piotrekuczy/jwt2015
 public void updateMap(float delta) {
   // System.out.println("update map");
   // draw kotara
   batch.begin();
   kotaraState.update(Gdx.graphics.getDeltaTime());
   kotaraState.apply(kotaraSkeleton);
   kotaraSkeleton.updateWorldTransform();
   sr.draw(batch, kotaraSkeleton);
   batch.end();
   stage.act(delta);
   stage.draw();
 }
コード例 #11
0
  @Override
  public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    batch.end();
    batch.begin();
    state.update(Gdx.graphics.getDeltaTime());
    state.apply(
        skeleton); // Poses skeleton using current animations. This sets the bones' local SRT.
    skeleton.updateWorldTransform(); // Uses the bones' local SRT to compute their world SRT.

    renderer.draw(batch, skeleton);
    batch.end();
    batch.begin();
    batch.draw(texture, this.getX(), this.getY() + 20f);
  }
コード例 #12
0
ファイル: VisSpine.java プロジェクト: 4630599/VisEditor
 @VisInternal
 public void updateValues(float x, float y, Color color) {
   skeleton.setPosition(x, y);
   skeleton.setColor(color);
 }
コード例 #13
0
ファイル: VisSpine.java プロジェクト: 4630599/VisEditor
 @Override
 public boolean isFlipX() {
   return skeleton.getFlipX();
 }
コード例 #14
0
 @Override
 public void reset() {
   skeleton.setPosition(0, -10);
   body.setTransform(0, -10, 0);
 }
コード例 #15
0
 public void setAg() {
   Random random = new Random();
   ag = Integer.toString(random.nextInt(14) + 1);
   skeleton.setSkin(ag);
   game.members.get(assignedname).ag = ag;
 }
コード例 #16
0
ファイル: Gamescreen.java プロジェクト: piotrekuczy/jwt2015
  public Gamescreen(Jamwteatrze game) {

    this.game = game;

    // set game state

    currentState = GameState.TITLE;
    // currentState = GameState.MAP;
    // currentState = GameState.ARENA;

    batch = new SpriteBatch();
    camera = new OrthographicCamera(1280, 720);
    camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);
    viewport = new FitViewport(1280, 720, camera);
    camera.update();

    // spine

    sr = new SkeletonRenderer();
    dr = new SkeletonRendererDebug();
    dr.setBoundingBoxes(false);
    dr.setRegionAttachments(false);

    // stage

    stage = new Stage(viewport, batch);
    stageCharacters = new Stage(viewport, batch);

    Gdx.input.setInputProcessor(stage);

    // ----------------- DEKLARACJE

    playerIcon = new SpineActor(batch, sr, shpr, "characters/goral", true, game.player.playerHp);

    playerIcon.setPosition(-400, 180);
    stageCharacters.addActor(playerIcon);

    generujEnemys();

    // atakuj button

    atakujTex = Assets.manager.get(Assets.atakuj, Texture.class);
    atakujTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    atakujButton = new ImageButton(new SpriteDrawable(new Sprite(atakujTex)));
    atakujButton.setPosition(565, -200);
    atakujButton.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (pulaGracza > 0 && !atakowanie) {
              atakowanie = true;
              System.out.println("atakuj button pressed");
              atakuj();
            }
            return true;
          }
        });

    stage.addActor(atakujButton);

    // gui

    font = Assets.manager.get(Assets.myFont, BitmapFont.class);
    font.getData().setScale(0.7f);
    font.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
    scena = Assets.manager.get(Assets.scena, Texture.class);
    scena.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    panel = Assets.manager.get(Assets.panel, Texture.class);
    panel.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // tla

    swiat00tlo = Assets.manager.get(Assets.swiat00tlo, Texture.class);
    swiat00tlo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    swiat01tlo = Assets.manager.get(Assets.swiat01tlo, Texture.class);
    swiat01tlo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    swiat02tlo = Assets.manager.get(Assets.swiat02tlo, Texture.class);
    swiat02tlo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    swiat03tlo = Assets.manager.get(Assets.swiat03tlo, Texture.class);
    swiat03tlo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    kowadloTex = Assets.manager.get(Assets.kowadloTex, Texture.class);
    kowadloTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    // kowadlo = new Sprite(kowadloTex);
    // kowadlo.setPosition(100, 100);

    // DICES

    heroDices = new Array<Dice>();
    enemyDices = new Array<Dice>();

    // ------ generate hero dieces
    heroDices.add(new Dice(this, true));
    heroDices.add(new Dice(this, true));
    // heroDices.add(new Dice(this));

    numberHeroDieces = heroDices.size;
    baseHeroDieces = numberHeroDieces;

    for (Dice dice : heroDices) {
      // dice.debug();
      dice.setTouchable(Touchable.disabled);
      dice.setVisible(false);
      stage.addActor(dice);
    }

    // ------ generate enemy dieces

    enemyDices.add(new Dice(this, false));
    enemyDices.add(new Dice(this, false));

    numberEnemyDieces = enemyDices.size;
    baseEnemyDieces = numberEnemyDieces;

    for (int i = 0; i < enemyDices.size; i++) {
      enemyDices.get(i).setPosition(725 + (i * 133), -150);
      if (!heroTurn) {
        enemyDices.get(i).addAction(moveTo(725 + (i * 133), 37, 1.0f, Interpolation.bounceOut));
      }
    }

    for (Dice dice : enemyDices) {
      // dice.debug();
      stage.addActor(dice);
    }

    // kotara

    kotaraAtlas = new TextureAtlas(Gdx.files.internal("gui/kotara.atlas"));
    kotaraJson = new SkeletonJson(kotaraAtlas);
    kotaraSkeletonData = kotaraJson.readSkeletonData(Gdx.files.internal("gui/kotara.json"));
    kotaraSkeleton = new Skeleton(kotaraSkeletonData);
    kotaraIdleAnimation = kotaraSkeletonData.findAnimation("idle");
    AnimationStateData stateData = new AnimationStateData(kotaraSkeletonData);
    kotaraState = new AnimationState(stateData);
    kotaraState.addAnimation(0, "idle", true, 0);
    kotaraSkeleton.setPosition(-200, -150);

    // title

    title = new SpineButton(batch, sr, "gui/title", "idle", 100, 0, 800, 600);
    // title.debug();
    title.setClicked(false);

    if (currentState == GameState.TITLE) {
      resetTitle();
    }

    // title listeners

    title.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (!title.isClicked() && title.getY() <= 20) {
              title.setClicked(true);
              fadeOutTitle(Gdx.graphics.getDeltaTime());
            }
            return true;
          }
        });

    stage.addActor(title);

    // mapa

    mapa = new SpineButton(batch, sr, "gui/mapa", "show0", 100, 0, 800, 600);
    mapa.setPosition(mapaX, -900);
    // mapa.debug();
    mapa.setClicked(false);

    // mapa listeners TODO!

    mapa.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            fadeOutMapa(Gdx.graphics.getDeltaTime());
            return true;
          }
        });

    stage.addActor(mapa);

    // if (currentState == GameState.ARENA) {
    // resetArena();
    // }
  }
コード例 #17
0
  public void render() {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    float delta = Gdx.graphics.getDeltaTime();

    // Draw skeleton origin lines.
    ShapeRenderer shapes = debugRenderer.getShapeRenderer();
    if (state != null) {
      shapes.setColor(Color.DARK_GRAY);
      shapes.begin(ShapeType.Line);
      shapes.line(skeleton.x, -99999, skeleton.x, 99999);
      shapes.line(-99999, skeleton.y, 99999, skeleton.y);
      shapes.end();
    }

    if (skeleton != null) {
      // Reload if skeleton file was modified.
      if (reloadTimer <= 0) {
        lastModifiedCheck -= delta;
        if (lastModifiedCheck < 0) {
          lastModifiedCheck = checkModifiedInterval;
          long time = skeletonFile.lastModified();
          if (time != 0 && lastModified != time) reloadTimer = reloadDelay;
        }
      } else {
        reloadTimer -= delta;
        if (reloadTimer <= 0) {
          loadSkeleton(skeletonFile);
          ui.toast("Reloaded.");
        }
      }

      // Pose and render skeleton.
      state.getData().setDefaultMix(ui.mixSlider.getValue());
      renderer.setPremultipliedAlpha(ui.premultipliedCheckbox.isChecked());

      skeleton.setFlip(ui.flipXCheckbox.isChecked(), ui.flipYCheckbox.isChecked());
      skeleton.setPosition(skeletonX, skeletonY);

      delta = Math.min(delta, 0.032f) * ui.speedSlider.getValue();
      skeleton.update(delta);
      state.update(delta);
      state.apply(skeleton);
      skeleton.updateWorldTransform();

      batch.setColor(Color.WHITE);
      batch.begin();
      renderer.draw(batch, skeleton);
      batch.end();

      debugRenderer.setBones(ui.debugBonesCheckbox.isChecked());
      debugRenderer.setRegionAttachments(ui.debugRegionsCheckbox.isChecked());
      debugRenderer.setBoundingBoxes(ui.debugBoundingBoxesCheckbox.isChecked());
      debugRenderer.setMeshHull(ui.debugMeshHullCheckbox.isChecked());
      debugRenderer.setMeshTriangles(ui.debugMeshTrianglesCheckbox.isChecked());
      debugRenderer.setPaths(ui.debugPathsCheckbox.isChecked());
      debugRenderer.draw(skeleton);
    }

    if (state != null) {
      // AnimationState status.
      status.setLength(0);
      for (int i = 0, n = state.getTracks().size; i < n; i++) {
        TrackEntry entry = state.getTracks().get(i);
        if (entry == null) continue;
        status.append(i);
        status.append(": [LIGHT_GRAY]");
        status(entry);
        status.append("[WHITE]");
        status.append(entry.animation.name);
        status.append('\n');
      }
      ui.statusLabel.setText(status);
    }

    // Render UI.
    ui.render();

    // Draw indicator lines for animation and mix times.
    if (state != null) {
      TrackEntry entry = state.getCurrent(0);
      if (entry != null) {
        shapes.begin(ShapeType.Line);

        float percent = entry.getAnimationTime() / entry.getAnimationEnd();
        float x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
        shapes.setColor(Color.CYAN);
        shapes.line(x, 0, x, 12);

        percent =
            entry.getMixDuration() == 0
                ? 1
                : Math.min(1, entry.getMixTime() / entry.getMixDuration());
        x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
        shapes.setColor(Color.RED);
        shapes.line(x, 0, x, 12);

        shapes.end();
      }
    }
  }
コード例 #18
0
  void loadSkeleton(final FileHandle skeletonFile) {
    if (skeletonFile == null) return;

    try {
      // Setup a texture atlas that uses a white image for images not found in the atlas.
      Pixmap pixmap = new Pixmap(32, 32, Format.RGBA8888);
      pixmap.setColor(new Color(1, 1, 1, 0.33f));
      pixmap.fill();
      final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
      pixmap.dispose();

      String atlasFileName = skeletonFile.nameWithoutExtension();
      if (atlasFileName.endsWith(".json"))
        atlasFileName = new FileHandle(atlasFileName).nameWithoutExtension();
      FileHandle atlasFile = skeletonFile.sibling(atlasFileName + ".atlas");
      if (!atlasFile.exists()) atlasFile = skeletonFile.sibling(atlasFileName + ".atlas.txt");
      TextureAtlasData data =
          !atlasFile.exists() ? null : new TextureAtlasData(atlasFile, atlasFile.parent(), false);
      TextureAtlas atlas =
          new TextureAtlas(data) {
            public AtlasRegion findRegion(String name) {
              AtlasRegion region = super.findRegion(name);
              if (region == null) {
                // Look for separate image file.
                FileHandle file = skeletonFile.sibling(name + ".png");
                if (file.exists()) {
                  Texture texture = new Texture(file);
                  texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
                  region = new AtlasRegion(texture, 0, 0, texture.getWidth(), texture.getHeight());
                  region.name = name;
                }
              }
              return region != null ? region : fake;
            }
          };

      // Load skeleton data.
      String extension = skeletonFile.extension();
      if (extension.equalsIgnoreCase("json") || extension.equalsIgnoreCase("txt")) {
        SkeletonJson json = new SkeletonJson(atlas);
        json.setScale(ui.scaleSlider.getValue());
        skeletonData = json.readSkeletonData(skeletonFile);
      } else {
        SkeletonBinary binary = new SkeletonBinary(atlas);
        binary.setScale(ui.scaleSlider.getValue());
        skeletonData = binary.readSkeletonData(skeletonFile);
        if (skeletonData.getBones().size == 0) throw new Exception("No bones in skeleton data.");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      ui.toast("Error loading skeleton: " + skeletonFile.name());
      lastModifiedCheck = 5;
      return;
    }

    skeleton = new Skeleton(skeletonData);
    skeleton.setToSetupPose();
    skeleton = new Skeleton(skeleton); // Tests copy constructors.
    skeleton.updateWorldTransform();

    state = new AnimationState(new AnimationStateData(skeletonData));
    state.addListener(
        new AnimationStateAdapter() {
          public void event(TrackEntry entry, Event event) {
            ui.toast(event.getData().getName());
          }
        });

    this.skeletonFile = skeletonFile;
    prefs.putString("lastFile", skeletonFile.path());
    prefs.flush();
    lastModified = skeletonFile.lastModified();
    lastModifiedCheck = checkModifiedInterval;

    // Populate UI.

    ui.window.getTitleLabel().setText(skeletonFile.name());
    {
      Array<String> items = new Array();
      for (Skin skin : skeletonData.getSkins()) items.add(skin.getName());
      ui.skinList.setItems(items);
    }
    {
      Array<String> items = new Array();
      for (Animation animation : skeletonData.getAnimations()) items.add(animation.getName());
      ui.animationList.setItems(items);
    }
    ui.trackButtons.getButtons().first().setChecked(true);

    // Configure skeleton from UI.

    if (ui.skinList.getSelected() != null) skeleton.setSkin(ui.skinList.getSelected());
    setAnimation();

    // ui.animationList.clearListeners();
    // state.setAnimation(0, "walk", true);
  }
コード例 #19
0
ファイル: Gamescreen.java プロジェクト: piotrekuczy/jwt2015
  public void updateArena(float delta) {

    // kowadlo
    if (kowadlo.isDropped() && kowadlo.getY() == 190) {

      enemys.peek().setDeleted(true);
      kowadlo.setPosition(1050, 900);
      kowadlo.setDropped(false);
    }

    // gameover, zapraklo hp playerowi
    if (game.player.playerHp <= 0) {
      // killEnemy();
      fadeOutArena();
    }

    // zabiles wszystkie enemysy
    if (enemys.size <= 0) {
      // generujEnemys();
      fadeOutArena();
    }

    batch.begin();
    switch (level) {
      case 0:
        batch.draw(swiat00tlo, 0, 0);
        break;
      case 1:
        batch.draw(swiat01tlo, 0, 0);
        break;
      case 2:
        batch.draw(swiat02tlo, 0, 0);
        break;
      case 3:
        batch.draw(swiat03tlo, 0, 0);
        break;
    }
    // total power numbers
    font.draw(batch, "total: ", 35, 100);
    font.draw(batch, pulaGracza + "", 50, 70, 50, Align.center, false);
    font.draw(batch, "total: ", 1160, 100);
    font.draw(batch, pulaPrzeciwnika + "", 1175, 70, 50, Align.center, false);
    batch.end();

    if (heroTurn) {
      checkHeroDices();
    } else {
      generateEnemyDices();
    }

    stageCharacters.act(delta);
    stageCharacters.draw();

    batch.begin();

    // wypisywanie actual hp
    font.draw(
        batch,
        game.player.playerHp + "",
        playerIcon.getX() - 25,
        playerIcon.getY() + 260,
        50,
        Align.center,
        false);

    if (enemys.size > 0) {
      font.draw(
          batch, enemys.peek().getHp() + "", enemys.peek().getX() - 15, enemys.peek().getY() + 260);
    }
    batch.end();

    // rysowanie paskow hp
    shpr.begin(ShapeType.Filled);
    playerIcon.renderHp(shpr);
    if (enemys.size > 0) {
      enemys.peek().renderHp(shpr);
    }
    shpr.end();

    // draw kotara
    batch.begin();
    kotaraState.update(Gdx.graphics.getDeltaTime());
    kotaraState.apply(kotaraSkeleton);
    kotaraSkeleton.updateWorldTransform();
    sr.draw(batch, kotaraSkeleton);
    batch.end();
    batch.begin();
    // turn info
    if (heroTurn) {
      font.draw(batch, "TURA GRACZA", 50, 700);
    } else {
      font.draw(batch, "TURA OBCYCH", 1050, 700);
    }
    // status przeciwnikow
    font.draw(batch, enemys.size + "", 600, 700, 50, Align.center, false);
    // kowadlo.draw(batch);
    batch.end();
    stage.act(delta);
    stage.draw();

    // check for deleting enemy from quest

    for (int i = 0; i < enemys.size; i++) {
      if (enemys.get(i).isDeleted()) {
        enemys.get(i).remove();
        enemys.removeIndex(i);
        if (enemys.size > 0) {
          if (enemys.size >= 45) {
            game.player.playerHp = game.player.playerHp + 10;
            playerIcon.setHp(game.player.playerHp);
          }
          showEnemy();
        }
      }
    }
  }
コード例 #20
0
ファイル: VisSpine.java プロジェクト: 4630599/VisEditor
 @Override
 public void setFlip(boolean flipX, boolean flipY) {
   skeleton.setFlip(flipX, flipY);
 }
コード例 #21
0
 @Override
 public void act(float delta) {
   super.act(delta);
   skeleton.setPosition(super.getX() + 40f, 230f);
 }