From 93d2f740fd63f01045fece1c4d2e0891bac5c5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Hor=C3=A1=C4=8Dek?= <horaceklubos@gmail.com> Date: Thu, 9 Jul 2015 15:11:11 +0200 Subject: [PATCH] #31 Target position updates --- .../game/games/shooting_range/ShootingRangeGame.java | 9 ++++----- .../shooting_range/tools/TargetPositionController.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java b/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java index 17dfb10a8..c00ebf657 100644 --- a/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java +++ b/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java @@ -1,6 +1,7 @@ package cz.nic.tablexia.game.games.shooting_range; import com.badlogic.gdx.scenes.scene2d.actions.Actions; +import com.badlogic.gdx.scenes.scene2d.ui.Image; import java.util.List; import java.util.Map; @@ -63,12 +64,13 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> { scene.getRows()[i].addTarget(target); } } - getStage().addAction(Actions.sequence(Actions.delay(1), Actions.run(new Runnable() { + scene.addAction(Actions.sequence(Actions.delay(3), Actions.run(new Runnable() { // TODO animate flowers in // TODO animate hand in // TODO animate carousel in @Override public void run() { + carousel.nextFlower(new Image(gfxLibrary.getTextureRegion(Textures.FLOWERS_LEVEL_EASY[((int) getData().getTime()) % Textures.FLOWERS_LEVEL_EASY.length]))); getData().setRunning(true); } }))); @@ -79,12 +81,9 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> { super.screenRender(delta); if (getData().isRunning()) { getData().addTime(delta); + targetPositionController.onUpdate(delta); } - - // TODO - // carousel.nextFlower(new Image(gfxLibrary.getTextureRegion(Textures.FLOWERS_LEVEL_EASY[((int) getData().getTime()) % Textures.FLOWERS_LEVEL_EASY.length]))); watch.setTime((int) getData().getTime()); - targetPositionController.onUpdate(delta); } private void initScene() { diff --git a/core/src/cz/nic/tablexia/game/games/shooting_range/tools/TargetPositionController.java b/core/src/cz/nic/tablexia/game/games/shooting_range/tools/TargetPositionController.java index 7f61ddc27..7d4e231c6 100644 --- a/core/src/cz/nic/tablexia/game/games/shooting_range/tools/TargetPositionController.java +++ b/core/src/cz/nic/tablexia/game/games/shooting_range/tools/TargetPositionController.java @@ -60,7 +60,7 @@ public class TargetPositionController { Set<Wave> waves = new HashSet<Wave>(); for (Target target : scene.getAllTargets()) { float x = target.getWave().getX(elapsedTime - target.getStartTime(), width); - if ((x > 0) && (x < width)) { + if (((x + target.getWidth()) > 0) && (x < width)) { // cil je na scene if (target.getParent() == null) { // jeste nebyl vykreslen, tak ho pridame do sceny -- GitLab