@Override public void fadeOut() { Tween.to(Launcher.instance().editorScreen.leftPaneBlocker, BlockerTweenAccessor.ALPHA, .3f) .target(0) .ease(Linear.INOUT) .start(tweenManager); Tween.to(Launcher.instance().editorScreen.rightPaneBlocker, BlockerTweenAccessor.ALPHA, .3f) .target(0) .ease(Linear.INOUT) .start(tweenManager); super.fadeOut(); }
private void executeCommand() { switch (struct.command) { case SET_VISIBLE: if (struct.animation != null) struct.animation.setVisible(struct.visible); else struct.button.setVisible(struct.visible); break; case SET_MOVEMENT: struct.animation.setMovement(struct.movement, struct.loopFor); struct.animation.setCurrentFrame(struct.startFrame); break; case SET_POSITION: struct.animation.setPosition(struct.x, struct.y); break; case SET_SCALE: struct.animation.setScale(struct.scale); break; case SET_HEALTH: target.setHealth(target.getHealth() - struct.damage); break; case MOVE_TO: Tween.to(struct.animation.getGroup(), GroupAccessor.POS_XY, struct.duration) .ease(Linear.INOUT) .target(struct.x, struct.y) .start(manager); break; case MOVE_TO_TARGET: Tween.to(struct.animation.getGroup(), GroupAccessor.POS_XY, struct.duration) .ease(Linear.INOUT) .target( target.getBasePosX() + ((target instanceof EnemyEntity) ? -struct.animation.getWidth() : target.getAnimation().getWidth()), target.getBasePosY()) .start(manager); break; case MOVE_TO_BASE: Tween.to(struct.animation.getGroup(), GroupAccessor.POS_XY, struct.duration) .ease(Linear.INOUT) .target(caster.getBasePosX(), caster.getBasePosY()) .start(manager); break; case POSITION_TO_TARGET: struct.animation.setPosition( target.getBasePosX() + struct.x, target.getBasePosY() + struct.y); break; case FLIP: struct.animation.flipAnimation(true, false); break; } index++; }
@Override public VisWindow fadeIn() { // Launcher.instance().editorScreen.leftPaneBlocker.alpha = .4f; Tween.to(Launcher.instance().editorScreen.leftPaneBlocker, BlockerTweenAccessor.ALPHA, .3f) .target(.4f) .ease(Linear.INOUT) .start(tweenManager); Tween.to(Launcher.instance().editorScreen.rightPaneBlocker, BlockerTweenAccessor.ALPHA, .3f) .target(.4f) .ease(Linear.INOUT) .start(tweenManager); return super.fadeIn(); }
private void setPlayTippingOver() { switch ((int) character.rotation) { case 0: tipOverSprite = new Sprite(tipOverE.getRegions()[11]); break; case 45: tipOverSprite = new Sprite(tipOverNe.getRegions()[11]); break; case 90: tipOverSprite = new Sprite(tipOverN.getRegions()[11]); break; case 135: tipOverSprite = new Sprite(tipOverNw.getRegions()[11]); break; case 180: tipOverSprite = new Sprite(tipOverW.getRegions()[11]); break; case 225: tipOverSprite = new Sprite(tipOverSw.getRegions()[11]); break; case 270: tipOverSprite = new Sprite(tipOverS.getRegions()[11]); break; case 315: tipOverSprite = new Sprite(tipOverSe.getRegions()[11]); break; } tipOverSprite.setBounds(character.getPosition().x - 1.5f, character.getPosition().y - 1, 4, 4); // For fading of killed animation Tween.registerAccessor(Sprite.class, new SpriteTween()); tweenManager = new TweenManager(); TweenCallback cb = new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { tweenCompleted(); } }; Tween.to(tipOverSprite, SpriteTween.ALPHA, 2.5f) .target(0) .ease(TweenEquations.easeInQuad) .setCallback(cb) .setCallbackTriggers(TweenCallback.COMPLETE) .start(tweenManager); }
/** * Splash Screen Constructor. * * @param tappy */ public SplashScreen(Tappy tappy) { // Core Variable. this.tappy = tappy; // Get sprites. splashHeadphone = Assets.getSprite("splashHeadphone"); splashBackground = Assets.getSprite("splashBackground"); // Set normal camera. orthographicCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); orthographicCamera.position.set( orthographicCamera.viewportWidth / 2f, orthographicCamera.viewportHeight / 2f, 0); orthographicCamera.update(); // Initialize TweenManager. tweenManager = new TweenManager(); Tween.registerAccessor(Sprite.class, new SpriteAccessor()); // Initialize splashScreen variable. splashNormalStage = new Stage(); // Trace player! HashMap<String, String> parameters = new HashMap<String, String>(); try { parameters.put( "signature", Helper.md5( (int) (Math.floor(((int) (System.currentTimeMillis() / 1000L) / 1000.0))) + "tHeJ3110pylnWzA-007!-+ei")); } catch (Exception e) { parameters.put("signature", "Error"); } parameters.put("function", "launch"); try { parameters.put("computerName", InetAddress.getLocalHost().getHostName()); } catch (Exception e) { parameters.put("computerName", "Unknown"); } try { parameters.put("javaVersion", System.getProperty("java.version")); } catch (Exception e) { parameters.put("javaVersion", "Unknown"); } parameters.put("isFirst", tappy.getPreferences().getBoolean("firstTime", true) ? "1" : "0"); HttpRequest httpPost = new HttpRequest(HttpMethods.POST); httpPost.setUrl("http://jellopy.in.th/tappy1eaTrace.php"); httpPost.setContent(HttpParametersUtils.convertHttpParameters(parameters)); Gdx.net.sendHttpRequest( httpPost, new HttpResponseListener() { @Override public void handleHttpResponse(HttpResponse httpResponse) {} @Override public void failed(Throwable error) {} @Override public void cancelled() {} }); }
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); Tween.registerAccessor(Rectangle.class, new BasicTweenAccessor()); setScreen(new FirstScreen(this)); }
@Override public void create() { tweenManager = new TweenManager(); Tween.registerAccessor(Sprite.class, new SpriteAccessor()); // Box2d world = new World(new Vector2(0, 0), true); // No gravity, space dah. world.step(1 / 60f, 6, 2); rayHandler = new RayHandler(world); rayHandler.setAmbientLight(0, 0, 0, 1f); // rayHandler.setAmbientLight(1f, 1f, 1f, 1f); rayHandler.setCulling(true); rayHandler.setBlur(true); rayHandler.setBlurNum(3); rayHandler.setShadows(true); RayHandler.isDiffuse = true; RayHandler.setGammaCorrection(true); controls = new GameControls(this); Gdx.input.setCursorCatched(true); camera = new OrthographicCamera(1080, 1920); spriteBatch = new SpriteBatch(); player = new PlayerShip(rayHandler, tweenManager); background = new Texture("backgroundbw.png"); enemies = new EnemyHandler(rayHandler, tweenManager); }
@Override public boolean touchUp(int x, int y, int pointer, int button) { Tween.to(veil, SpriteAccessor.OPACITY, 0.7f) .target(1) .setCallback(callback) .start(tweenManager); return true; }
public static Timeline moveAlongPath( Path<GridPoint2> path, float stepDuration, Object target, int tweenType) { Timeline timeline = Timeline.createSequence(); for (GridPoint2 point : path.getPoints()) { timeline = timeline.push(Tween.to(target, tweenType, stepDuration).target(point.x, point.y)); } return timeline; }
private void setupTween() { Tween.registerAccessor(Sprite.class, new SpriteAccessor()); manager = new TweenManager(); TweenCallback cb = new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { game.setScreen(new GameScreen()); } }; Tween.to(sprite, SpriteAccessor.ALPHA, .8f) .target(1) .ease(TweenEquations.easeInOutQuad) .repeatYoyo(1, .4f) .setCallback(cb) .setCallbackTriggers(TweenCallback.COMPLETE) .start(manager); }
private void shrink() { selected = false; disableClick(); Tween.to(SetCard.this, Accessor.XYWH, 0.1f) // .targetRelative(-(1-scaleXY)*width/2, -(1-scaleXY)*height/2, -(scaleXY-1)*width, // -(scaleXY-1)*height) .targetRelative(growWidth, growHeight, -growWidth * 2, -growHeight * 2) .ease(Quad.OUT) .start(tweenManager); enableClick(); }
private void grow() { selected = true; showBorder(); disableClick(); Tween.to(SetCard.this, Accessor.XYWH, 0.1f) // .targetRelative((1-scaleXY)*width/2, (1-scaleXY)*height/2, (scaleXY-1)*width, // (scaleXY-1)*height) .targetRelative(-growWidth, -growHeight, growWidth * 2, growHeight * 2) .ease(Quad.OUT) .start(tweenManager); enableClick(); }
@Override protected Timeline showAnimation() { this.levelStartAnimation = Timeline.createSequence(); float y = (stage.getHeight() + this.levelImage.getHeight()) / 2f; Tween slideinTween = Tween.to(this.levelImage, ActorAccessor.POSITION_Y, 1f) .ease(TweenEquations.easeInOutQuint) .target(y); slideinTween.setCallbackTriggers(TweenCallback.COMPLETE); slideinTween.setCallback( new TweenCallback() { @Override public void onEvent(int arg0, BaseTween<?> arg1) { levelStartAnimation.pause(); imageStartAnimationFinished = true; startScreenCloseAnimation(); } }); this.levelStartAnimation.push(slideinTween); this.levelStartAnimation.push(Tween.to(this.filter, ActorAccessor.ALPHA, 0.5f).target(0f)); y = stage.getHeight() + levelImage.getHeight(); Tween slideoutTween = Tween.to(this.levelImage, ActorAccessor.POSITION_Y, 0.5f) .ease(TweenEquations.easeInQuint) .target(y); slideoutTween.setCallbackTriggers(TweenCallback.COMPLETE); slideoutTween.setCallback( new TweenCallback() { @Override public void onEvent(int arg0, BaseTween<?> arg1) { levelImage.remove(); filter.remove(); MusicPlayer.getInstance().playNext(); getGameEngine().startGamePlay(); } }); levelStartAnimation.push(slideoutTween); return this.levelStartAnimation; }
private void onExit( final Screen screen, TextButton buttonPlay, TextButton buttonCredits, TextButton buttonExit) { Tween.set(buttonPlay, ActorAccessor.ALPHA) .target(buttonPlay.getColor().a) .start(getTweenManager()); Tween.to(buttonPlay, ActorAccessor.ALPHA, 0.5f).target(0).delay(0.2f).start(getTweenManager()); Tween.set(buttonCredits, ActorAccessor.ALPHA) .target(buttonCredits.getColor().a) .start(getTweenManager()); Tween.to(buttonCredits, ActorAccessor.ALPHA, 0.5f) .target(0) .delay(0.1f) .start(getTweenManager()); Tween.set(buttonExit, ActorAccessor.ALPHA) .target(buttonExit.getColor().a) .start(getTweenManager()); Tween.to(buttonExit, ActorAccessor.ALPHA, 0.5f) .target(0) .setCallback( new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { getGame().setScreen(screen); } }) .start(getTweenManager()); }
@Override public void show() { super.show(); table = new Table(); table.setFillParent(true); TextButtonStyle bStyle = new TextButtonStyle(); bStyle.font = Cache.getFont(48); bStyle.fontColor = Color.LIGHT_GRAY; final TextButton buttonPlay = new TextButton("PLAY", bStyle); buttonPlay.pad(20); table.add(buttonPlay); table.row(); final TextButton buttonCredits = new TextButton("CREDITS", bStyle); buttonCredits.pad(20); table.add(buttonCredits); table.row(); final TextButton buttonExit = new TextButton("EXIT", bStyle); buttonExit.pad(20); table.add(buttonExit); table.pad(150, 0, 0, 0); getStage().addActor(table); buttonPlay.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { onExit(new LevelSelect(getGame()), buttonPlay, buttonCredits, buttonExit); } }); buttonCredits.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { onExit(new Credits(getGame()), buttonPlay, buttonCredits, buttonExit); } }); buttonExit.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Gdx.app.exit(); } }); Tween.set(buttonPlay, ActorAccessor.ALPHA).target(0).start(getTweenManager()); Tween.to(buttonPlay, ActorAccessor.ALPHA, 1).target(1).start(getTweenManager()); Tween.set(buttonCredits, ActorAccessor.ALPHA).target(0).start(getTweenManager()); Tween.to(buttonCredits, ActorAccessor.ALPHA, 1).target(1).delay(0.1f).start(getTweenManager()); Tween.set(buttonExit, ActorAccessor.ALPHA).target(0).start(getTweenManager()); Tween.to(buttonExit, ActorAccessor.ALPHA, 1).target(1).delay(0.2f).start(getTweenManager()); Gdx.input.setInputProcessor(new InputMultiplexer(getStage(), new TouchDetector(this))); }
public void animate() { if (placement.equals(Placement.RELATIVE)) { CameraHandler cameraHandler = gui.getApp().getCameraHandler(); Vector2 targetPosition = new Vector2(target.x + target.width / 2, target.y + target.height / 2); Vector2 cameraPosition = new Vector2(cameraHandler.getCamera().position.x, cameraHandler.getCamera().position.y); float time = targetPosition.dst(cameraPosition) / (App.WORLD_SCALE * 10); Tween.to(cameraHandler, CameraHandlerAccessor.SET, Math.max(2f, time)) .target(targetPosition.x, targetPosition.y) .ease(TweenEquations.easeOutCubic) .start(App.getTweenManager()); /* Tween.to(cameraHandler, CameraHandlerAccessor.ZOOM, 1).target(cameraHandler.getCamera().zoom / 2).start( App.getTweenManager()); */ } }
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); }
/** Launch splashScreen. */ @Override public void show() { // Switch to normal stage. tappy.setStage(splashNormalStage); // Register tweenEngine timeline. Timeline.createSequence() // Set default values. .push(Tween.set(splashHeadphone, SpriteAccessor.ALPHA).target(0)) .push(Tween.set(splashBackground, SpriteAccessor.ALPHA).target(0)) .push( Tween.set(splashBackground, SpriteAccessor.POSITION) .target(0, -(splashBackground.getHeight() - Gdx.graphics.getHeight()))) // FadeIn & Slide down. .push(Tween.to(splashHeadphone, SpriteAccessor.ALPHA, 1.2f).target(1)) .pushPause(1.4f) .push(Tween.to(splashHeadphone, SpriteAccessor.ALPHA, 1.2f).target(0)) .beginParallel() .push(Tween.to(splashBackground, SpriteAccessor.ALPHA, 5.2f).target(1)) .push(Tween.to(splashBackground, SpriteAccessor.POSITION, 9.8f).target(0, 0).ease(Quad.OUT)) .end() // Waiting. .pushPause(1.2f) // FadeOut. .push(Tween.to(splashBackground, SpriteAccessor.ALPHA, 0.7f).target(0)) // Register callback. .setCallback( new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { if (tappy.getPreferences().getBoolean("firstTime", true)) { tappy.setScreen(new TutorialScreen(tappy)); } else { tappy.setScreen(new HomeScreen(tappy)); } } }) // Launch! .start(tweenManager); }
private void buildMenuComponents(final TextureAtlas menuButtonAtlas) { if (progressPanel != null) { progressPanel.remove(); } addActor(makeLibGDXLogo(menuButtonAtlas)); addActor(makeHappyDroidsLogo(menuButtonAtlas)); MainMenuButtonPanel menuButtonPanel = new MainMenuButtonPanel(); menuButtonPanel.pack(); menuButtonPanel.setY(droidTowersLogo.getY() - menuButtonPanel.getHeight()); menuButtonPanel.setX(-droidTowersLogo.getImageWidth()); addActor(menuButtonPanel); Tween.to(menuButtonPanel, WidgetAccessor.POSITION, CAMERA_PAN_DOWN_DURATION) .target( 50 + (45 * (droidTowersLogo.getImageWidth() / droidTowersLogo.getWidth())), menuButtonPanel.getY()) .ease(TweenEquations.easeInOutExpo) .start(TweenSystem.manager()); }
@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); } }
@Override public void create() { camera = new OrthoCamera(); camera.resize(); touch = new Vector2(0, 0); TextureRegion back = new TextureRegion(Assets.manager.get(Assets.guisheet, Texture.class), 0, 270, 150, 150); backButton = new Button( back, new Vector2( (back.getRegionWidth() / 3), MainGame.HEIGHT - (back.getRegionHeight() + (back.getRegionWidth() / 3)))); bgManager = new BackgroundManager(); Tween.registerAccessor(Sprite.class, new SpriteAccessor()); tweenManager = new TweenManager(); cardAnimSprite = new Sprite(); cardAnimSprite.setCenter(MainGame.WIDTH / 2, MainGame.HEIGHT / 2); cardAnimSprite.setScale(0.001f); alpha = Assets.manager.get(Assets.alpha, Texture.class); randomCardButton = new SpriteButton( new TextureRegion(Assets.manager.get(Assets.random_card, Texture.class)), new Vector2(MainGame.WIDTH / 4 - 250, 300)); rareCardButton = new SpriteButton( new TextureRegion(Assets.manager.get(Assets.rare_card, Texture.class)), new Vector2(MainGame.WIDTH - MainGame.WIDTH / 4 - 250, 300)); unlockedText = new SpriteText("You Have Unlocked", Fonts.menuFont); unlockedText.setPosition( MainGame.WIDTH / 2 - Fonts.menuFont.getBounds(unlockedText.getText()).width / 2, MainGame.HEIGHT - 100); currGold = "Gold: " + MainGame.userStats.getPlayerGold(); }
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))); }
private void hideBorder() { tweenManager.killTarget(borderThickness); Tween.to(SetCard.this, Accessor.BORDER_THICKNESS, 0.4f).target(2).start(tweenManager); }
static { Tween.registerAccessor(AbstractEntity.class, new TweenAccessorEntity()); }
public SplashScreen(TweenCallback callback) { this.callback = callback; TextureAtlas atlas = Assets.inst().get("data/splash/pack", TextureAtlas.class); universal = atlas.createSprite("universal"); tween = atlas.createSprite("tween"); engine = atlas.createSprite("engine"); logo = atlas.createSprite("logo"); strip = atlas.createSprite("white"); powered = atlas.createSprite("powered"); gdx = atlas.createSprite("gdxblur"); veil = atlas.createSprite("white"); gdxTex = atlas.findRegion("gdx"); float wpw = 1f; float wph = wpw * Gdx.graphics.getHeight() / Gdx.graphics.getWidth(); camera.viewportWidth = wpw; camera.viewportHeight = wph; camera.update(); Gdx.input.setInputProcessor(inputProcessor); Sprite[] sprites = new Sprite[] {universal, tween, engine, logo, powered, gdx}; for (Sprite sp : sprites) { sp.setSize(sp.getWidth() / PX_PER_METER, sp.getHeight() / PX_PER_METER); sp.setOrigin(sp.getWidth() / 2, sp.getHeight() / 2); } universal.setPosition(-0.325f, 0.028f); tween.setPosition(-0.320f, -0.066f); engine.setPosition(0.020f, -0.087f); logo.setPosition(0.238f, 0.022f); strip.setSize(wpw, wph); strip.setOrigin(wpw / 2, wph / 2); strip.setPosition(-wpw / 2, -wph / 2); powered.setPosition(-0.278f, -0.025f); gdx.setPosition(0.068f, -0.077f); veil.setSize(wpw, wph); veil.setPosition(-wpw / 2, -wph / 2); veil.setColor(1, 1, 1, 0); Timeline.createSequence() .push(Tween.set(tween, SpriteAccessor.POS_XY).targetRelative(-1, 0)) .push(Tween.set(engine, SpriteAccessor.POS_XY).targetRelative(1, 0)) .push(Tween.set(universal, SpriteAccessor.POS_XY).targetRelative(0, 0.5f)) .push(Tween.set(logo, SpriteAccessor.SCALE_XY).target(7, 7)) .push(Tween.set(logo, SpriteAccessor.OPACITY).target(0)) .push(Tween.set(strip, SpriteAccessor.SCALE_XY).target(1, 0)) .push(Tween.set(powered, SpriteAccessor.OPACITY).target(0)) .push(Tween.set(gdx, SpriteAccessor.OPACITY).target(0)) .pushPause(0.5f) .push(Tween.to(strip, SpriteAccessor.SCALE_XY, 0.8f).target(1, 0.6f).ease(Back.OUT)) .push(Tween.to(tween, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Quart.OUT)) .push(Tween.to(engine, SpriteAccessor.POS_XY, 0.5f).targetRelative(-1, 0).ease(Quart.OUT)) .push( Tween.to(universal, SpriteAccessor.POS_XY, 0.6f) .targetRelative(0, -0.5f) .ease(Quint.OUT)) .pushPause(-0.3f) .beginParallel() .push(Tween.set(logo, SpriteAccessor.OPACITY).target(1)) .push(Tween.to(logo, SpriteAccessor.SCALE_XY, 0.5f).target(1, 1).ease(Back.OUT)) .end() .push(Tween.to(strip, SpriteAccessor.SCALE_XY, 0.5f).target(1, 1).ease(Back.IN)) .pushPause(0.3f) .beginParallel() .push(Tween.to(tween, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .push(Tween.to(engine, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .push(Tween.to(universal, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .push(Tween.to(logo, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .end() .pushPause(-0.3f) .push(Tween.to(powered, SpriteAccessor.OPACITY, 0.3f).target(1)) .beginParallel() .push(Tween.to(gdx, SpriteAccessor.OPACITY, 1.5f).target(1).ease(Cubic.IN)) .push(Tween.to(gdx, SpriteAccessor.ROTATION, 2.0f).target(360 * 15).ease(Quad.OUT)) .end() .pushPause(0.3f) .push( Tween.to(gdx, SpriteAccessor.SCALE_XY, 0.6f) .waypoint(1.6f, 0.4f) .target(1.2f, 1.2f) .ease(Cubic.OUT)) .pushPause(0.3f) .beginParallel() .push(Tween.to(powered, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .push(Tween.to(gdx, SpriteAccessor.POS_XY, 0.5f).targetRelative(1, 0).ease(Back.IN)) .end() .pushPause(0.3f) .setCallback(callback) .start(tweenManager); }
@Override public void update() { if (Gdx.input.justTouched()) { touch = MainGame.camera.unprojectCoordinates(Gdx.input.getX(), Gdx.input.getY()); if (showingCard) { TweenCallback myCallBack = new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { purchasedCard = null; showingCard = false; } }; Tween.to(cardAnimSprite, SpriteAccessor.SCALE_XY, 10f) .target(0.001f, 0.001f) .ease(TweenEquations.easeNone) .setCallback(myCallBack) .setCallbackTriggers(TweenCallback.END) .start(tweenManager); startTime = TimeUtils.millis(); } else { if (backButton.checkTouch(touch)) { SoundManager.play(Assets.CLICK); ScreenManager.setScreen(new MainMenuScreen()); } else if (randomCardButton.checkTouch(touch)) { long myGold = MainGame.userStats.getPlayerGold(); if (myGold >= randomCardCost) { MainGame.userStats.addGold(-randomCardCost); purchasedCard = CardCreator.createCard((int) (Math.random() * MainGame.numberOfCards + 1)); MainGame.userStats.getPlayerCardList().insert(0, purchasedCard.getID()); MainGame.saveManager.saveDataValue("PLAYER", MainGame.userStats); currGold = "Gold: " + MainGame.userStats.getPlayerGold(); Tween.to(cardAnimSprite, SpriteAccessor.SCALE_XY, 10f) .target(1.5f, 1.5f) .ease(TweenEquations.easeNone) .start(tweenManager); startTime = TimeUtils.millis(); showingCard = true; } } else if (rareCardButton.checkTouch(touch)) { long myGold = MainGame.userStats.getPlayerGold(); if (myGold >= rareCardCost) { MainGame.userStats.addGold(-rareCardCost); purchasedCard = CardCreator.createCard((int) (Math.random() * MainGame.numberOfCards + 1)); MainGame.userStats.getPlayerCardList().insert(0, purchasedCard.getID()); MainGame.saveManager.saveDataValue("PLAYER", MainGame.userStats); currGold = "Gold: " + MainGame.userStats.getPlayerGold(); Tween.to(cardAnimSprite, SpriteAccessor.SCALE_XY, 10f) .target(1.5f, 1.5f) .ease(TweenEquations.easeNone) .start(tweenManager); startTime = TimeUtils.millis(); showingCard = true; } } } } bgManager.update(); }
@Override public void show() { super.show(); backgroundStage.addActor(new Image(atlas.findRegion("background"))); Image alien = new Image(atlas.findRegion("alien")); alien.setPosition(mainStage.getWidth() + mainStage.getPadLeft(), -365f); mainStage.addActor(alien); Image energy = new Image(atlas.findRegion("energy")); // 195, 313 energy.setPosition(83f, 201f); energy.setScale(0f); energy.setOrigin(energy.getPrefWidth() / 2, energy.getPrefHeight() / 2); mainStage.addActor(energy); final Table certificateTable = new Table(); certificateTable.padTop(314f).padBottom(101f).defaults().padBottom(100f); certificateTable.setBackground(new TextureRegionDrawable(atlas.findRegion("certificate"))); certificateTable.setSize(mainStage.getWidth(), mainStage.getHeight()); certificateTable.setOrigin(195f, 313f); certificateTable.setTransform(true); certificateTable.setTouchable(Touchable.disabled); certificateTable.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Assets.fanfareFX.stop(); game.loadNextScreen(EndingScreen.this, KonnectingGame.ScreenType.MAIN_MENU); } }); certificateTable.setScale(0f); mainStage.addActor(certificateTable); StatsData tempData = SavedData.getStats(); int score = tempData.kronosScore1 + tempData.kronosScore2 + tempData.kronosScore3 + tempData.kronosScore4 + tempData.kronosScore5 + tempData.kronosScore6 + tempData.kronosScore7 + tempData.zappingScore1 + tempData.zappingScore2 + tempData.zappingScore3 + tempData.zappingScore4 + tempData.zappingScore5; final Label userLabel = new Label( SavedData.getUsername() + "\n\n" + score + "pt", new Label.LabelStyle(uiSkin.getFont("default-font"), Color.WHITE)); userLabel.setWrap(true); userLabel.setAlignment(Align.center); userLabel.getColor().a = 0f; certificateTable.add(userLabel).width(407f).row(); String correctComment = comments[0]; for (int i = scoreLimits.length - 1; i >= 0; i--) { if (score > scoreLimits[i]) { correctComment = comments[i]; break; } } final Label commentLabel = new Label(correctComment, new Label.LabelStyle(uiSkin.getFont("arial"), Color.WHITE)); commentLabel.setWrap(true); commentLabel.setFontScale(0.9f); commentLabel.setAlignment(Align.center); commentLabel.getColor().a = 0f; certificateTable.add(commentLabel).width(407f); Timeline.createSequence() .push(Tween.to(alien, ActorAccessor.MOVE_X, 1f).target(20f)) .pushPause(0.25f) .push(Tween.to(energy, ActorAccessor.SCALEXY, 1f).target(1f)) .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(0.8f)) .push(Tween.to(energy, ActorAccessor.SCALEXY, 0.5f).target(1f)) .push(Tween.to(certificateTable, ActorAccessor.SCALEXY, 0.5f).target(1f)) .beginParallel() .push(Tween.to(userLabel, ActorAccessor.ALPHA, 0.5f).target(1f)) .push(Tween.to(commentLabel, ActorAccessor.ALPHA, 0.5f).target(1f)) .end() .setCallback( new TweenCallback() { @Override public void onEvent(int type, BaseTween<?> source) { Assets.fanfareFX.setOnCompletionListener( new Music.OnCompletionListener() { @Override public void onCompletion(Music music) { Assets.fanfareFX.setOnCompletionListener(null); certificateTable.setTouchable(Touchable.enabled); } }); Assets.fanfareFX.play(); } }) .start(tweenManager); }