public TileEffectDialog(Hexpert hexpert, Skin skin) { super(hexpert, skin, false); getContentTable().defaults().pad(15); for(int i = 0; i < TileType.values().length; i++) { TileType tileType = TileType.values()[i]; Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png"))); getContentTable().add(tileImage).width(96).height(96); Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin); lblDesc.setAlignment(Align.center); getContentTable().add(lblDesc); getContentTable().row(); } }
private void createUndoButton() { Skin skin = new Skin(); Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); pixmap.setColor(Color.WHITE); pixmap.fill(); skin.add("white", new Texture(pixmap)); skin.add("default", new BitmapFont()); TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1)); textButtonStyle.font = skin.getFont("default"); skin.add("default", textButtonStyle); btnUndo = new TextButton("UNDO", skin); btnUndo.setX(70); btnUndo.setY(Gdx.graphics.getHeight() - 25); btnUndo.setWidth(60); btnUndo.setVisible(true); group.addActor(btnUndo); }
private void drawtopcombat(){ groupTop = new Group(); Texture lookup = managerAssets.getAssetsCombat().getTexture(NameFiles.progressbarcircular); lookup.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); progressBarEnergy = ProgressBarEnergy.getInstance(); Image imageLeftprofile = new Image(new TextureRegion(managerAssets.getAssetsButton().get(NameFiles.buttonBack1))); imageLeftprofile.setSize(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getWidth() * 0.15f); imageLeftprofile.setPosition(imageLeftprofile.getWidth() * 0.1f, Gdx.graphics.getHeight() - imageLeftprofile.getHeight() * 1.1f); imageLeftprofile.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { if(InformationProfile.getInstance().getDateUserGame().getEnklaveCombatId() == -1) gameManager.setScreen(gameManager.screenEnklave); else dialogExit("You can't out from combat!"); } }); groupTop.addActor(imageLeftprofile); }
/** * Constructor that allows to specify if there is an effect of waves and splash particles. * @param waves Specifies whether the object will have waves * @param splashParticles Specifies whether the object will have splash particles */ public Water(boolean waves, boolean splashParticles) { this.waves = waves; this.splashParticles = splashParticles; this.fixturePairs = new HashSet<Pair<Fixture, Fixture>>(); this.setDebugMode(false); if (waves) { textureWater = new TextureRegion(new Texture(Gdx.files.internal("water.png"))); polyBatch = new PolygonSpriteBatch(); } if (splashParticles) { textureDrop = new Texture(Gdx.files.internal("drop.png")); spriteBatch = new SpriteBatch(); particles = new ArrayList<Particle>(); } shapeBatch = new ShapeRenderer(); shapeBatch.setColor(0, 0.5f, 1, 1); }
public void saveAndReload(Map map, Pixmap out){ if(map.pixmap != null && out != map.pixmap && map.texture != null){ map.texture.dispose(); map.texture = new Texture(out); }else if (out == map.pixmap){ map.texture.draw(out, 0, 0); } map.pixmap = out; if(map.texture == null) map.texture = new Texture(map.pixmap); if(map.id == -1){ if(mapNames.containsKey(map.name)){ map.id = mapNames.get(map.name).id; }else{ map.id = ++lastID; } } if(!Settings.has("hiscore" + map.name)){ Settings.defaults("hiscore" + map.name, 0); } saveCustomMap(map); Vars.ui.levels.reload(); }
@Override public void create() { rotationSpeed = 0.5f; mesh = new Mesh(true, 4, 6, new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"), new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords")); texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg")); mesh.setVertices(new float[] { -1024f, -1024f, 0, 0, 1, 1024f, -1024f, 0, 1, 1, 1024f, 1024f, 0, 1, 0, -1024f, 1024f, 0, 0, 0 }); mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 }); cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH; yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT; font = loadBitmapFont("default.fnt", "default.png"); scale = Math.min(xScale, yScale); cam.zoom = 1/scale; // cam.project(start_position); cam.position.set(0, 0, 0); batch = new SpriteBatch(); }
@Override public void addActor(ActorAddEvent event) { Actor actor = event.actor; StringBuilder item_name = new StringBuilder(); item_name.append(actor.getName()==null?"":actor.getName()); item_name.append("["); item_name.append(EditorManager.getInstance() .getActorType(actor).getSimpleName()); item_name.append("]"); Tree.Node item = createNodeItem(actor,item_name.toString()); item.setIcon(new TextureRegionDrawable(new TextureRegion(new Texture( Gdx.files.internal("icon/Label_16.png"))))); item.getActor().setTouchable(Touchable.disabled); if (actor.getParent() instanceof MainWindow){ stageNode.add(item); }else { Tree.Node parentNode = stageNode.findNode(actor.getParent()); if (parentNode!=null) parentNode.add(item); } tree.getSelection().choose(item); }
public BuildingScoreDialog(Hexpert hexpert, Skin skin) { super(hexpert, skin, false); getContentTable().defaults().pad(15); Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class); Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin); lblExplaination.setWrap(true); lblExplaination.setAlignment(Align.center); getContentTable().add(lblExplaination).colspan(8).width(8*160); lblExplaination.setWrap(true); getContentTable().row(); for (int i = 1; i < BuildingType.values().length; i++) { BuildingType buildingType = BuildingType.values()[i]; Image image = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png"))); getContentTable().add(image).width(160).height(160); Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle); lblScore.setAlignment(Align.center); getContentTable().add(lblScore).expand(); if (i % 4 == 0) getContentTable().row(); } }
public GameCenter(Chat game){ this.game = game; /*Camera Settings*/ camera = new OrthographicCamera(); camera.setToOrtho(false,480,800); camera.position.set(480/2,800/2,0); /*Button Areas*/ wordTiles = new Rectangle(480/2-250/2,800/2,250,55); Arkanoid = new Rectangle(480/2-250/2,800/2-60,250,55); WordCrush = new Rectangle(480/2-250/2,800/2-120,250,55); EndlessRoad = new Rectangle(480/2-250/2,800/2-180,250,55); bottone4 = new Rectangle(480/2-250/2,800/2-240,250,55); buttonTexture = new Texture("green_button00.png"); touch = new Vector3(); }
/** * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized. * It also adds Listeners to the Skins' Buttons. * * @param table Table where the Skins' Labels and Buttons will be organized. */ private void createSkins(Table table) { for (int i = 0; i < game.getNumSkins(); ++i) { //Adding Buttons and Labels to the Arrays skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class))))); skinLabels.add(new Label("Current", skin1)); final int j = i; //Needed for Listener initialization skinButtons.get(i).addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { setCurrentLabel(j); } }); table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE); } table.row(); for (int i = 0; i < game.getNumSkins(); ++i) table.add(skinLabels.get(i)); initializeCurrentSkin(); }
public void setTexture(Texture texture, boolean setNewDimension) { Texture oldTexture = this.texture; this.texture = texture; // set dimension of texture setDimension(texture.getWidth(), texture.getHeight()); if (setNewDimension) { // update width and height this.positionComponent.setDimension(texture.getWidth(), texture.getHeight()); if (this.texture != null) { // update dimension this.width = this.texture.getWidth(); this.height = this.texture.getHeight(); } } this.textureChangedListenerList.stream().forEach(listener -> { listener.onTextureChanged(oldTexture, this.texture); }); }
public GameScreen(String playerName) { camera = new Camera(); player = new Player(playerName,0,0,"Players/player.png"); controller = new CursedEchoController(player); stage = new Stage(); map = GameUtils.getGame().assetHandler.get("World/grass.png",Texture.class); camera.setToOrtho(false,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2); camera.update(); switch(Gdx.app.getType()) { case Android: controller.addTouchPad(stage); break; default: break; } }
static Skin loadSkin() { String folder = "ui/x" + bestMultiplier + "/"; // Base skin Skin skin = new Skin(Gdx.files.internal("skin/uiskin.json")); // Nine patches final int border = (int)(28 * bestMultiplier); skin.add("button_up", new NinePatch(new Texture( Gdx.files.internal(folder + "button_up.png")), border, border, border, border)); skin.add("button_down", new NinePatch(new Texture( Gdx.files.internal(folder + "button_down.png")), border, border, border, border)); for (String id : ids) { skin.add(id + "_texture", new Texture(Gdx.files.internal(folder + id + ".png"))); } folder = "font/x" + bestMultiplier + "/"; skin.add("font", new BitmapFont(Gdx.files.internal(folder + "geosans-light64.fnt"))); skin.add("font_small", new BitmapFont(Gdx.files.internal(folder + "geosans-light32.fnt"))); skin.add("font_bonus", new BitmapFont(Gdx.files.internal(folder + "the-next-font.fnt"))); return skin; }
public AssetsRooms() { manager = new AssetManager(); manager.load(NameFiles.topenklaveimage,Texture.class); manager.load(NameFiles.noselectRooms,Texture.class); manager.load(NameFiles.selectroombottom,Texture.class); manager.load(NameFiles.selectroomleft,Texture.class); manager.load(NameFiles.selectroomright,Texture.class); manager.load(NameFiles.txtSelectRoom,Texture.class); manager.load(NameFiles.imageArrowBottom,Texture.class); manager.load(NameFiles.imageArrowRight,Texture.class); manager.load(NameFiles.imagePulse,Texture.class); manager.load(NameFiles.extensionImgBackground,Texture.class); manager.load(NameFiles.borderImageBlue,Texture.class); manager.load(NameFiles.borderUpdown,Texture.class); manager.load(NameFiles.progressbarcircular,Texture.class); manager.load(NameFiles.imageBarrack,Texture.class); manager.load(NameFiles.imageCommCenter,Texture.class); manager.load(NameFiles.imageLaboratory,Texture.class); manager.load(NameFiles.frameEnk,Texture.class); }
/** * Creates a new power up entity. * * @param ecs * entity component system * @param x * x start position * @param y * y start position * @param texture * texture * @return power up entity */ public static Entity createPowerup(EntityManager ecs, float x, float y, Texture texture) { // create new entity Entity powerupEntity = new Entity(ecs); // every entity requires a position component powerupEntity.addComponent(new PositionComponent(x, y), PositionComponent.class); // add texture component to draw texture powerupEntity.addComponent(new DrawTextureComponent(texture, texture.getWidth() / 2, texture.getHeight() / 2), DrawTextureComponent.class); // add collision component, so entity can collide with other space // shuttles or meteorites powerupEntity.addComponent(new CollisionComponent(), CollisionComponent.class); powerupEntity.getComponent(CollisionComponent.class) .addInnerShape(new CCircle(texture.getWidth() / 2, texture.getHeight() / 2, texture.getWidth() / 2)); //avoid camera shake on collision and sounds on collision powerupEntity.addComponent(new AvoidCollisionCameraShakeComponent(), AvoidCollisionCameraShakeComponent.class); powerupEntity.addComponent(new AvoidCollisionSoundComponent(), AvoidCollisionSoundComponent.class); return powerupEntity; }
@Override protected void onInit(ScreenBasedGame game, AssetManager assetManager) { // load assets assetManager.load(MUSIC_PATH, Music.class); assetManager.load(BACKGROUND_IMAGE_PATH, Texture.class); assetManager.finishLoadingAsset(MUSIC_PATH); assetManager.finishLoadingAsset(BACKGROUND_IMAGE_PATH); // get assets this.music = assetManager.get(MUSIC_PATH, Music.class); this.bgTexture = assetManager.get(BACKGROUND_IMAGE_PATH, Texture.class); // generate fonts this.titleFont = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE, Color.BLUE, 3); // this.font2 = // BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", // 48, Color.RED, Color.WHITE, 3); this.font1 = BitmapFontFactory.createFont("./data/font/arial/arial.ttf", 18, Color.WHITE); this.font2 = BitmapFontFactory.createFont("./data/font/arial/arial-bold.ttf", 24, Color.WHITE, Color.RED, 3); // generate credits text array try { this.generateCreditLines(); } catch (IOException e) { e.printStackTrace(); // TODO: remove this line and handle exception with exception window System.exit(0); } Gdx.input.setInputProcessor(null); }
public GameOver(GameStateManager gsm, int score) { super(gsm); this.score = score; camera.setToOrtho(false, FlappyBaran.WIDTH / 2, FlappyBaran.HEIGHT / 2); background = new Texture("backgrnd.jpg"); gameover = new Texture("gameover.png"); font = new BitmapFont(); prefs = Gdx.app.getPreferences("FlappyBaran"); if (!prefs.contains("highScore")) { prefs.putInteger("highScore", 0); } prevHighScore = getHighScore(); if (prevHighScore < this.score) { setHighScore(this.score); highscore = this.score; } else { highscore = prevHighScore; } }
public void loadTextures() { assetManager.load(SkinAsset.UISKIN, Skin.class); assetManager.load(TextureAsset.PLAYER_DEFAULT, Texture.class); assetManager.load(TextureAsset.POWERUP_RANDOM, Texture.class); assetManager.load(TextureAsset.POWERUP_MISSILE, Texture.class); assetManager.load(TextureAsset.POWERUP_ARMOR, Texture.class); assetManager.load(TextureAsset.POWERUP_MULTISHOT, Texture.class); assetManager.load(TextureAsset.POWERUP_BOMB, Texture.class); assetManager.load(TextureAsset.PLAYER_INVULNERABLE, Texture.class); assetManager.load(TextureAsset.OBSTACLE, Texture.class); assetManager.load(TextureAsset.PROJECTILE, Texture.class); assetManager.load(TextureAsset.OBSTACLE_EXPLOSION, Texture.class); assetManager.load(TextureAsset.PLAYER_RED, Texture.class); assetManager.load(TextureAsset.PLAYER_BLUE, Texture.class); assetManager.load(TextureAsset.PLAYER_GREEN, Texture.class); assetManager.load(TextureAsset.PLAYER_YELLOW, Texture.class); assetManager.load(TextureAsset.TOUCH_BACKGROUND, Texture.class); assetManager.load(TextureAsset.TOUCH_KNOB, Texture.class); assetManager.load(TextureAsset.BOMB, Texture.class); assetManager.load(TextureAsset.BOMB_EXPLOSION, Texture.class); assetManager.load(TextureAsset.EXPLOSION, Texture.class); assetManager.load(TextureAsset.MISSILE, Texture.class); assetManager.update(); }
public Group createPuls(float x, float y){ grPuls = new Group(); Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial); Image image = new Image(new TextureRegion(txt)); Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); image.setSize(crop.x * 0.135f, crop.y * 0.135f); image.setPosition(x, y); grPuls.addActor(image); txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable); Image puls = new Image(new TextureRegion(txt)); crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); puls.setSize(1, 1); MoveToAction move = new MoveToAction(); move.setDuration(1); move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f); MoveToAction mo = new MoveToAction(); mo.setDuration(0); mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); ScaleToAction scale = new ScaleToAction(); scale.setScale(WIDTH*0.17f); scale.setDuration(1); ScaleToAction sc = new ScaleToAction(); sc.setDuration(0); sc.setScale(0); RepeatAction repeat = new RepeatAction(); repeat.setCount(RepeatAction.FOREVER); repeat.setAction(new SequenceAction(scale, sc)); puls.addAction(repeat); RepeatAction r = new RepeatAction(); r.setCount(RepeatAction.FOREVER); r.setAction(new SequenceAction(move, mo)); puls.addAction(r); grPuls.addActor(puls); return grPuls; }
public TerrainTileRenderer(List<List<Integer>> world, int tileSize) { this.world = world; this.tileSize = tileSize; // build the tile map with the tile specifications Texture tilesTexture = new Texture(Gdx.files.internal("tiles.png")); tilesTexture.getTextureData().prepare(); this.tilesPixmap = tilesTexture.getTextureData().consumePixmap(); this.tileRegions = TextureRegion.split(tilesTexture, tileSize, tileSize); if (tilesTexture.getTextureData().disposePixmap()) { tilesTexture.dispose(); } }
public void setBuilding(BuildingType buildingType) { this.buildingType = buildingType; switch (buildingType) { case HOUSE: setTexture(AssetLoader.assetManager.get("house.png", Texture.class)); break; case WIND: setTexture(AssetLoader.assetManager.get("wind.png", Texture.class)); break; case FARM: setTexture(AssetLoader.assetManager.get("farm.png", Texture.class)); break; case MINE: setTexture(AssetLoader.assetManager.get("mine.png", Texture.class)); break; case FACTORY: setTexture(AssetLoader.assetManager.get("factory.png", Texture.class)); break; case MARKET: setTexture(AssetLoader.assetManager.get("market.png", Texture.class)); break; case BANK: setTexture(AssetLoader.assetManager.get("bank.png", Texture.class)); break; case ROCKET: setTexture(AssetLoader.assetManager.get("rocket.png", Texture.class)); break; case NONE: setTexture(null); break; } }
@Override public void show() { //"wie" der Constructor SM.input.setInputProcessor(this); batch = new SpriteBatch(); img = new Texture("assets/guenter_right.png"); imagePos = new Vector2(0, 0); imagePosMovement = new Vector2(0,0); }
public UpgradePack() { posX = MathUtils.random(350)+ 50; posY = Gdx.graphics.getHeight(); speed = 150f; texture = AssetLoader.assetManager.get("upgrade.png", Texture.class); powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class); sprite = new Sprite(texture); sprite.setOriginCenter(); sprite.setScale(0.7f); sprite.setPosition(posX, posY); }
public void Install(Installed object) { this.object = object; for (Tile.SolidTiles i : Tile.SolidTiles.values()) { if (i.name().equals(object.name())) { this.solid = true; } } this.hasObject = true; this.installImg = new Texture(this.object.toString().toLowerCase() + ".png"); this.InstallID = Installed.valueOf(this.object.toString()).ordinal(); this.installing = false; this.preinstall = false; }
public Bird(int x, int y){ position = new Vector3(x, y, 0); velosity = new Vector3(0, 0, 0); texture = new Texture("Sheep-Animated-Gif4.png"); birdAnimation = new Animation(new TextureRegion(texture), FRAME_COUNT, 0.9f); bounds = new Rectangle(x, y, texture.getWidth() / FRAME_COUNT, texture.getHeight()); flap = Gdx.audio.newSound(Gdx.files.internal("sfx_wing.ogg")); }
public Entity(Texture t, float x, float y){ texture = t; position = new Vector2(x , y); if(t !=null) { size = new Vector2(texture.getWidth(), texture.getHeight()); body = new Rectangle(x, y, texture.getWidth(), texture.getHeight()); } else System.out.println("[Entity] WARNING: SIZE and BODY are null, be sure to set them elsewhere."); }
public ThrowableNonSplashAttackSpell(OffensiveSpell spell, Texture lookout, long id, Monster source, GameObjectsContainer linkedContainer, PacketsSender packetsSender) { super(lookout, id, linkedContainer, packetsSender); this.spell = spell; this.source = source; this.packetsSender = packetsSender; }
public static void parseButton(VisImageButton button, XmlReader.Element element){ String upPath = element.get("up"); String downPath = element.get("down"); String checkPath = element.get("check"); Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(upPath)))); Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(downPath)))); Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(checkPath)))); VisImageButton.VisImageButtonStyle buttonStyle = new VisImageButton.VisImageButtonStyle( up,down,checked,up,down,checked ); button.setStyle(buttonStyle); attr2Button(button, new String[]{upPath, downPath, checkPath}); }
public Chapa(int x, int y) { position = new Vector3(x, y, 0); velocity = new Vector3(0, 0, 0); texture = new Texture("chapaanimation.png"); birdAnimation = new Animation(new TextureRegion(texture), 3, 0.5f); bounds = new Rectangle(x, y, texture.getWidth() / 3, texture.getHeight()); initSounds(); }
public PlayState(GameStateManager gsm) { super(gsm); score = 0; chapa = new Chapa(50, 300); camera.setToOrtho(false, FlappyChapa.WIDTH / 2, FlappyChapa.HEIGHT / 2); Texture texture = new Texture("bg.png"); backGround = new org.academiadecodigo.bootcamp.sprites.Background(camera); backGround.start(); ground = new Texture("ground.png"); /*table = new Table(); table.setPosition(camera.position.x,camera.position.y); //table.setBounds(camera.position.x,camera.position.y,camera.viewportWidth,camera.viewportHeight/10); table.setFillParent(true);*/ scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE)); scoreLabel.setPosition(camera.position.x,0); startTime = TimeUtils.nanoTime(); anto = new Anto(camera); // groundPos1 = new Vector2(camera.position.x - camera.viewportWidth / 2, GROUND_Y_OFFSET); // groundPos2 = new Vector2((camera.position.x - camera.viewportWidth / 2) + ground.getWidth(), GROUND_Y_OFFSET); tubes = new Array<Tube>(); for (int i = 0; i < TUBE_COUNT; i++) { tubes.add(new Tube(i * (TUBE_SPACING + Tube.TUBE_WIDTH))); } music = Gdx.audio.newMusic(Gdx.files.internal("bigSmoke_justAudio.mp3")); music.setLooping(true); music.setVolume(0.5f); music.play(); }
/** * Initialisierung * * @param game zeigt auf das SchoolGame, dass das Spiel verwaltet */ @Override public void create(SchoolGame game) { this.game = game; batch = new SpriteBatch(); Texture splashImg = new Texture(Gdx.files.internal("data/misc/splashscreen.png")); screenSprite = new Sprite(splashImg); screenSprite.setPosition(-screenSprite.getWidth() / 2, -screenSprite.getHeight() / 2); screenSprite.setAlpha(0); timer = SHOW_TIME + FADE_TIME * 2; }
private static CustomAnimation<TextureRegion> createBloodAnimation() { Texture bloodSheet = Assets.get("bloodSheetAnimation.png"); TextureRegion[][] textures = TextureRegion.split(bloodSheet, bloodSheet.getWidth()/4, bloodSheet.getHeight()/4); CustomAnimation<TextureRegion> animation = new CustomAnimation<>(0.1f, textures); return animation; }
private boolean isEqual(Texture a, Texture b) { if (a.getDepth() != b.getDepth()) return false; if (a.getHeight() != b.getHeight()) return false; if (a.getWidth() != b.getWidth()) return false; if (!a.getTextureData().getFormat().equals(b.getTextureData().getFormat())) return false; if (a.getTextureData().getHeight() != b.getTextureData().getHeight()) return false; if (a.getTextureData().getWidth() != b.getTextureData().getWidth()) return false; if (!a.getTextureData().getType().equals(b.getTextureData().getType())) return false; return true; }
public void progress(float cx, float cy, float r, float thickness, float amt, Color c, Texture lookup) { //start and end angles float start = 0f; float end = amt * 360f; lookup.bind(); renderer.begin(cam.combined, GL20.GL_TRIANGLE_STRIP); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); int segs = (int)(24 * Math.cbrt(r)); end += 90f; start += 90f; float halfThick = thickness/2f; float step = 360f / segs; for (float angle=start; angle<(end+step); angle+=step) { float tc = 0.5f; if (angle==start) tc = 0f; else if (angle>=end) tc = 1f; float fx = MathUtils.cosDeg(angle); float fy = MathUtils.sinDeg(angle); float z = 0f; renderer.color(c.r, c.g, c.b, c.a); renderer.texCoord(tc, 1f); renderer.vertex(cx + fx * (r + halfThick), cy + fy * (r + halfThick), z); renderer.color(c.r, c.g, c.b, c.a); renderer.texCoord(tc, 0f); renderer.vertex(cx + fx * (r + -halfThick), cy + fy * (r + -halfThick), z); } renderer.end(); }
public PixelBuffer() { super(Pixmap.Format.RGBA8888, Scene.BUFFER_WIDTH, Scene.BUFFER_HEIGHT, false); getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest); pixelBufferRegion = new TextureRegion(getColorBufferTexture(), 0, 0, Scene.BUFFER_WIDTH, Scene.BUFFER_HEIGHT); pixelBufferRegion.flip(false, true); }
public Tube(float x) { topTube = new Texture("toptube1.png"); bottomTube = new Texture("bottomtube1.png"); random = new Random(); posTopTube = new Vector2(x, random.nextInt(FLUCTUATION) + TUBE_GAP + LOWEST_OPENING); posBotTube = new Vector2(x, posTopTube.y - TUBE_GAP - bottomTube.getHeight()); boundsTop = new Rectangle(posTopTube.x, posTopTube.y, topTube.getWidth(), topTube.getHeight()); boundsBot = new Rectangle(posBotTube.x, posBotTube.y, bottomTube.getWidth(), bottomTube.getHeight()); }
private void loadSprites() { Texture texture = new Texture(Gdx.files.internal("tileset.png")); minionSprite = new Sprite(texture, 15 * tilewidth + 1, 10 * tilewidth + 1, tilewidth, tilewidth); float scale = 2; minionSprite.setScale((mapHeight / (float) Gdx.graphics.getHeight()) / scale); towerSprite = new Sprite(texture, 19 * tilewidth + 1, 7 * tilewidth + 1, tilewidth, tilewidth); scale = 3; towerSprite.setScale((mapHeight / (float) Gdx.graphics.getHeight()) / scale); }
/** * Creates the animation used for this PowerUp Type. * * @param game the game this view belongs to. Needed to access the * asset manager to get textures. * @param fileName the path to the file that contains the animation sheet. * @return the animation used for this PowerUp */ private Animation<TextureRegion> createAnimation(Armadillo game, String fileName) { Texture texture = game.getAssetManager().get(fileName); TextureRegion[][] regions = TextureRegion.split(texture, texture.getWidth() / NUM_FRAMES, texture.getHeight()); TextureRegion[] frames = new TextureRegion[NUM_FRAMES]; System.arraycopy(regions[0], 0, frames, 0, NUM_FRAMES); return new Animation<>(FRAME_TIME, frames); }
public Pig(int x, int y) { super(x, y); pig = new Texture("PigRun.png"); pigDead = new Texture("PigDead.png"); pigAnimation = new Animation(new TextureRegion(pig),4,0.5f); pig1Animation = new Animation(new TextureRegion(pigDead),27,0.5f); pigBounds = new Rectangle(x,y,70,45); }
public MoveEventManager(PlayScreen screen) { batch = screen.getBatch(); this.hexpert = screen.getHexpert(); this.badMoveTexture = hexpert.assetManager.get(TEXTURE_BAD, Texture.class); badMoves = new ArrayList<PointTime>(); score = new ArrayList<IntPointTime>(); }