@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); }
/** * 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() {} }); }
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); }
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); }
@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))); }
static { Tween.registerAccessor(AbstractEntity.class, new TweenAccessorEntity()); }