public void fadeOutArena() { System.out.println("fade out arena"); // wyjeb kostki for (Dice dice : heroDices) { dice.setStopklatka(false); dice.setTouchable(Touchable.disabled); dice.addAction(moveTo(dice.getX(), -200, 1.0f, Interpolation.fade)); } // // wyjeb atakuj atakujButton.addAction(moveTo(565, -200, 1.0f, Interpolation.fade)); // zamknij kotare kotaraState.setAnimation(0, "close", false); // if (kotaraState.getCurrent(0) == null) { // System.out.println("kotara sie zamknela"); // } if (kotaraState.getCurrent(0).isComplete()) { System.out.println("REKSIO"); } game.player.playerHp = game.initialHp; playerIcon.setHp(game.player.playerHp); // generujEnemys(); title.setClicked(false); currentState = GameState.TITLE; resetMapa(); resetTitle(); }
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(); }
void setAnimation() { if (ui.animationList.getSelected() == null) return; int track = ui.trackButtons.getCheckedIndex(); TrackEntry current = state.getCurrent(track); TrackEntry entry; if (current == null) { state.setEmptyAnimation(track, 0); entry = state.addAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked(), 0); entry.setMixDuration(ui.mixSlider.getValue()); } else { entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked()); } entry.setAlpha(ui.alphaSlider.getValue()); }
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(); } } }