List of usage examples for com.badlogic.gdx.graphics.g2d ParticleEffectPool ParticleEffectPool
public ParticleEffectPool(ParticleEffect effect, int initialCapacity, int max)
From source file:at.therefactory.jewelthief.ui.Particles.java
License:Open Source License
public Particles(TextureAtlas textureAtlas) { fireworkEffects = new ParticleEffectPool.PooledEffect[5]; startColors = new float[][] { // new float[] { 0, .58f, 1 }, // blue new float[] { 1, .984f, .267f }, // yellow new float[] { .969f, .11f, 1 }, // pink new float[] { 1, .02f, .082f }, // red new float[] { .816f, 0, 1 }, // violet new float[] { 0, 1, .098f }, // green };//from w w w. j a v a 2 s. c om ParticleEffect fireworksEffect = new ParticleEffect(); fireworksEffect.load(Gdx.files.internal("particles/fireworks.p"), textureAtlas); // if particle effect includes additive or pre-multiplied particle emitters // you can turn off blend function clean-up to save a lot of draw calls // but remember to switch the Batch back to GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA // before drawing "regular" sprites or your Stage. fireworksEffect.setEmittersCleanUpBlendFunction(false); fireworksEffectPool = new ParticleEffectPool(fireworksEffect, 1, 5); for (int i = 0; i < fireworkEffects.length; i++) { ParticleEffectPool.PooledEffect effect = fireworksEffectPool.obtain(); resetFireworksEffect(effect); fireworkEffects[i] = effect; } }
From source file:com.quadbits.gdxhelper.scenemodel.handlers.ParticleEffectActorModelHandler.java
License:Apache License
@Override public Object create(BaseModel model, String id, boolean forceCreation) { // Safeguard against duplicate calls if (!forceCreation && model.created) { return null; }/*from w w w . j ava 2s .c o m*/ model.created = true; // Id if (id == null) { id = model.id; } ParticleEffectActorModel actorModel = (ParticleEffectActorModel) model; HashMap<String, Actor> allActors = sceneModelManager.getAllActors(); ArrayList<Actor> resizeableActorsAbsolute = sceneModelManager.getResizeableActorsAbsolute(); HashMap<String, Controller> allControllers = sceneModelManager.getAllControllers(); HashMap<String, ParticleEffectPool> particleEffectPools = sceneModelManager.getParticleEffectPools(); // Get parent Group parent = null; if (actorModel.parent != null && actorModel.addToParent) { parent = (Group) allActors.get(actorModel.parent); } // Create particle effect actor ParticleEffectActor actor = particleEffectActorPool.obtain(); actor.setName(id); if (parent != null) { parent.addActor(actor); } allActors.put(id, actor); resizeableActorsAbsolute.add(actor); // Get pooled effect from pool, create pool if it does not exist ParticleEffectPool effectPool = particleEffectPools.get(actorModel.effectFile); if (effectPool == null) { ParticleEffect prototype = new ParticleEffect(); if (actorModel.atlasPrefix == null) { prototype.load(Gdx.files.internal(actorModel.effectFile), textureAtlasProxy.get()); } else { prototype.load(Gdx.files.internal(actorModel.effectFile), textureAtlasProxy.get(), actorModel.atlasPrefix); } effectPool = new ParticleEffectPool(prototype, 1, 70); particleEffectPools.put(actorModel.effectFile, effectPool); // prototype.dispose(); } ParticleEffectPool.PooledEffect effect = effectPool.obtain(); effect.start(); actor.setEffect(effect); // Process controllers if (actorModel.controllers != null) { for (String controllerId : actorModel.controllers) { Controller controller = allControllers.get(controllerId); if (controller != null) { actor.addController(controller); } } } return actor; }
From source file:com.sturdyhelmetgames.roomforchange.assets.Assets.java
License:Apache License
private static void setupAssets() { fontBigBlack = new TextureRegion(get(TEXTURE_FONT_BIG_BLACK, Texture.class)).split(8, 8)[0]; fontBigWhite = new TextureRegion(get(TEXTURE_FONT_BIG_WHITE, Texture.class)).split(8, 8)[0]; fontSmallBlack = new TextureRegion(get(TEXTURE_FONT_SMALL_BLACK, Texture.class)).split(4, 4)[0]; fontSmallWhite = new TextureRegion(get(TEXTURE_FONT_SMALL_WHITE, Texture.class)).split(4, 4)[0]; mummyWalkFront = new Animation(0.2f, new TextureRegion[] { getGameObject("mummy-front-1"), getGameObject("mummy-front-2"), getGameObject("mummy-front-3"), getGameObject("mummy-front-4"), }); snakeWalkFront = new Animation(0.1f, new TextureRegion[] { getGameObject("snake-front-1"), getGameObject("snake-front-2"), getGameObject("snake-front-3") }); snakeWalkBack = new Animation(0.1f, new TextureRegion[] { getGameObject("snake-back-1"), getGameObject("snake-back-2"), getGameObject("snake-back-3") }); final TextureRegion[] snakeLeftRegions = new TextureRegion[] { getGameObject("snake-left-1"), getGameObject("snake-left-2"), getGameObject("snake-left-3") }; snakeWalkLeft = new Animation(0.1f, snakeLeftRegions); snakeWalkRight = new Animation(0.1f, flipRegionsHorizontally(snakeLeftRegions)); mummyWalkBack = new Animation(0.2f, new TextureRegion[] { getGameObject("mummy-back-1"), getGameObject("mummy-back-2"), getGameObject("mummy-back-3"), getGameObject("mummy-back-4"), }); TextureRegion[] mummyLeftRegions = new TextureRegion[] { getGameObject("mummy-left-1"), getGameObject("mummy-left-2"), getGameObject("mummy-left-3"), getGameObject("mummy-left-4"), }; mummyWalkLeft = new Animation(0.2f, mummyLeftRegions); mummyWalkRight = new Animation(0.2f, flipRegionsHorizontally(mummyLeftRegions)); playerWalkFront = new Animation(0.15f, new TextureRegion[] { getGameObject("player-front-1"), getGameObject("player-front-idle"), getGameObject("player-front-2"), getGameObject("player-front-idle"), }); playerWalkBack = new Animation(0.15f, new TextureRegion[] { getGameObject("player-back-1"), getGameObject("player-back-idle"), getGameObject("player-back-2"), getGameObject("player-back-idle"), }); playerWalkRight = new Animation(0.2f, new TextureRegion[] { getGameObject("player-right-1"), getGameObject("player-right-2"), }); playerWalkLeft = new Animation(0.2f, new TextureRegion[] { getGameObject("player-left-1"), getGameObject("player-left-2"), }); playerDying = new Animation(0.3f, new TextureRegion[] { getGameObject("player-dying-1"), getGameObject("player-dying-2"), getGameObject("player-dying-3"), getGameObject("player-dying-4"), getGameObject("player-dying-5"), }); playerDying.setPlayMode(Animation.NORMAL); playerFalling = new Animation(0.3f, new TextureRegion[] { getGameObject("player-falling-1"), getGameObject("player-falling-2"), getGameObject("player-falling-3"), getGameObject("empty") }); playerFalling.setPlayMode(Animation.NORMAL); spiderFront = new Animation(0.2f, new TextureRegion[] { getGameObject("spider-front-1"), getGameObject("spider-front-2") }); kingSpiderFront = new Animation(0.2f, new TextureRegion[] { getGameObject("king-spider-front-1"), getGameObject("king-spider-front-2") }); hitTarget = new Animation(0.1f, new TextureRegion[] { getGameObject("hit-1"), getGameObject("hit-2"), getGameObject("hit-3"), }); bomb = new Animation(0.3f, new TextureRegion[] { getGameObject("bomb-1"), getGameObject("bomb-2") }); bomb.setPlayMode(Animation.LOOP);//from w ww. j a v a 2 s . c o m sandStreamPool = new ParticleEffectPool(get(PARTICLE_SANDSTREAM, ParticleEffect.class), 5, 10); sandSmokeRightPool = new ParticleEffectPool(get(PARTICLE_SANDSMOKE_RIGHT, ParticleEffect.class), 5, 10); sandSmokeLeftPool = new ParticleEffectPool(get(PARTICLE_SANDSMOKE_LEFT, ParticleEffect.class), 5, 10); sandSmokeUpPool = new ParticleEffectPool(get(PARTICLE_SANDSMOKE_UP, ParticleEffect.class), 5, 10); sandSmokeDownPool = new ParticleEffectPool(get(PARTICLE_SANDSMOKE_DOWN, ParticleEffect.class), 5, 10); enemydiePool = new ParticleEffectPool(get(PARTICLE_ENEMY_DIE, ParticleEffect.class), 5, 10); explosionPool = new ParticleEffectPool(get(PARTICLE_EXPLOSION, ParticleEffect.class), 5, 10); }
From source file:com.wotf.game.GameStage.java
/** * @param pEff sets the temporarily particle effect */// w ww . j a va2 s. c om public void setParticle(ParticleEffect pEff) { tempParticleEffects = pEff; explosionEffectPool = new ParticleEffectPool(tempParticleEffects, 1, 5); //tempParticleEffects.setEmittersCleanUpBlendFunction(false); }
From source file:de.gebatzens.meteva.PlayerSpaceship.java
License:Open Source License
public PlayerSpaceship(double x, double y) { super(GScout.getRegion("raumschiff"), x, y); width *= 0.7f;/*from ww w .ja v a 2s . c o m*/ scaleToScreenSize(); updateRect(); rnormal = texture; reis = GScout.getRegion("raumschifffrost"); firetex = GScout.getRegion("raumschiffglut"); ParticleEffect bombEffect = new ParticleEffect(); bombEffect.loadEmitters(Gdx.files.internal("particles/partikeltest")); bombEffect.loadEmitterImages(Gdx.files.internal("particles")); bombEffectPool = new ParticleEffectPool(bombEffect, 1, 2); PooledEffect effect = bombEffectPool.obtain(); effects.add(effect); ScaledNumericValue value = effect.getEmitters().get(0).getScale(); highMax = value.getHighMax(); highMin = value.getHighMin(); lowMax = value.getLowMax(); lowMin = value.getLowMin(); value = effect.getEmitters().get(0).getVelocity(); vhighMax = value.getHighMax(); vhighMin = value.getHighMin(); vlowMax = value.getLowMax(); vlowMin = value.getLowMin(); }
From source file:headmade.arttag.screens.ArtTagScreen.java
License:Apache License
public ArtTagScreen(DirectedGame game, String map) { super(game);// , new Stage(new ExtendViewport(MIN_WORLD_WIDTH, MIN_WORLD_HEIGHT), game.getBatch())); fpsLogger = new FPSLogger(); Player.instance.inventory.clear();/*from www . j a va 2s . c o m*/ Player.instance.setControlArtCount(0); Player.instance.setArtScanCount(0); Player.instance.setArtViewCount(0); Player.instance.isMoveDown = false; Player.instance.isMoveUp = false; Player.instance.isMoveLeft = false; Player.instance.isMoveRight = false; camera = new OrthographicCamera(MIN_WORLD_WIDTH, MIN_WORLD_HEIGHT); ((OrthographicCamera) camera).zoom = 0.5f; // perspectiveCam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); // perspectiveCam.position.set(300f, 3000f, 1000f); // perspectiveCam.lookAt(300, 300, 0); // perspectiveCam.near = 0.1f; // perspectiveCam.far = 10000f; // perspectiveCam.update(); contactListener = new ArtTagContactListener(this); this.world = new World(new Vector2(0f, 0f), true); world.setContactListener(contactListener); world.setDestructionListener(new DestructionListener() { }); /** BOX2D LIGHT STUFF BEGIN */ rayHandler = new RayHandler(world); rayHandler.setAmbientLight(0.08f, 0.08f, 0.16f, 0.1f); rayHandler.setBlurNum(ArtTag.gameSettings.blur); rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR); // RayHandler.setGammaCorrection(true); RayHandler.useDiffuseLight(true); // rayHandler.setBlur(false); /** BOX2D LIGHT STUFF END */ shapeRenderer = new ShapeRenderer(); box2dDebugRenderer = new Box2DDebugRenderer(); inputController = new ArtTagInputController(game, this); jobDescActor = new Label("", Assets.instance.skin, "jobDesc"); imageActor = new Image(Assets.assetsManager.get(AssetTextures.animal4, Texture.class)); jobDescActor.setWrap(true); instructionsActor = new Label("Instructions", Assets.instance.skin, "info"); instructionsActor.setWrap(true); instructionsActor.setVisible(false); resultActor = new Label("Result", Assets.instance.skin, "scanner"); resultActor.setVisible(false); resultActor.setAlignment(Align.center); final Label scoreLabel = new Label("Your Score", Assets.instance.skin, "white"); final Label highscoreLabel = new Label("Highscore", Assets.instance.skin, "white"); final Label scoreActor = new Label("$" + Player.instance.getCash(), Assets.instance.skin, "dollar"); final Label highscoreActor = new Label("$" + ArtTag.highScore, Assets.instance.skin, "dollar"); Gdx.app.log(TAG, "camera.viewportWidth " + camera.viewportWidth + " Gdx.graphics.getWidth(): " + Gdx.graphics.getWidth()); rootTable = new Table(Assets.instance.skin); rootTable.setFillParent(true); rootTable.add(jobDescActor).pad(10f).width(camera.viewportWidth / ArtTag.UNIT_SCALE / 4); rootTable.add(imageActor).center().expand(); rootTable.add(instructionsActor).top().right().pad(10f).width(camera.viewportWidth / ArtTag.UNIT_SCALE / 4); rootTable.row(); rootTable.add(scoreLabel).left(); rootTable.add(); rootTable.add(highscoreLabel).right(); rootTable.row(); rootTable.add(scoreActor).left(); rootTable.add(resultActor).center().width(camera.viewportWidth / ArtTag.UNIT_SCALE / 4); rootTable.add(highscoreActor).right(); stage.addActor(rootTable); newJob(); MapUtils.loadMap(this, map != null ? map : AssetMaps.map1); final Loader<Sprite> loader = Assets.instance.getSpriterLoader(); drawer = new LibGdxDrawer(loader, game.getBatch(), shapeRenderer); final headmade.arttag.spriter.Player player = new headmade.arttag.spriter.Player( Assets.instance.getMaggieSpriterData()); player.setAnimation("run"); player.setScale(ArtTag.UNIT_SCALE * 0.8f); players.add(player); smokeEffect = new ParticleEffect(); smokeEffect.load(Gdx.files.internal(AssetParticles.smoke), Assets.instance.atlas); smokeEffect.scaleEffect(ArtTag.UNIT_SCALE); smokeEffectPool = new ParticleEffectPool(smokeEffect, 2, 4); }
From source file:io.github.deathsbreedgames.spacerun.screens.GameScreen.java
public GameScreen(AssetManager manager) { super("Splash", manager); // Create buttons mainStage = new Stage(new StretchViewport(GlobalVars.width, GlobalVars.height)); buttonAtlas = manager.get("gfx/ui/buttons.pack", TextureAtlas.class); buttonSkin = new Skin(buttonAtlas); Gdx.input.setInputProcessor(mainStage); ImageButtonStyle imgBtnStyle = new ImageButtonStyle(); imgBtnStyle.imageUp = buttonSkin.getDrawable("ExitButton"); ImageButton exitButton = new ImageButton(imgBtnStyle); exitButton.setPosition(GlobalVars.width - (exitButton.getWidth() + 5f), GlobalVars.height - (exitButton.getHeight() + 5f)); mainStage.addActor(exitButton);//from w ww .j av a 2 s . co m exitButton.addListener(new ChangeListener() { public void changed(ChangeEvent e, Actor a) { setNextScreen("MainMenu"); setDone(true); } }); // Setup draw stuff camera = new OrthographicCamera(GlobalVars.width, GlobalVars.height); camera.position.set(GlobalVars.width / 2, GlobalVars.height / 2, 0f); camera.update(); batch = new SpriteBatch(); spaceshipAtlas = manager.get("gfx/sprites/spaceships.pack", TextureAtlas.class); bulletAtlas = manager.get("gfx/sprites/bullets.pack", TextureAtlas.class); pickupAtlas = manager.get("gfx/sprites/pickups.pack", TextureAtlas.class); font = new BitmapFont(); font.scale(0.01f); // Create ship if (GlobalVars.ship == 0) { player = new Player(spaceshipAtlas.findRegion("bluedestroyer"), 160, 50, 1, 1000, 250, 0.5f); } else if (GlobalVars.ship == 1) { player = new Player(spaceshipAtlas.findRegion("bluecarrier"), 160, 50, 0, 2000, 250, 0.5f); } else { player = new Player(spaceshipAtlas.findRegion("bluecruiser"), 160, 50, 0, 1000, 500, 0.5f); } // Setup enemies enemies = new Enemy[NUM_ENEMIES]; for (int i = 0; i < NUM_ENEMIES; i++) { enemies[i] = null; } currentMaxEnemies = 1; currentEnemies = 0; // Setup bullets bullets = new Bullet[NUM_BULLETS]; for (int i = 0; i < NUM_BULLETS; i++) { bullets[i] = null; } // Setup pickups pickup = null; pickupTimer = 0; rapidTimer = 0; speed = false; speedTimer = 0; invTimer = 0; // Setup Particle Effects ParticleEffect explosionEffect = new ParticleEffect(); explosionEffect.load(Gdx.files.internal("gfx/particles/Explosion.p"), Gdx.files.internal("gfx/particles/")); explosionEffectPool = new ParticleEffectPool(explosionEffect, 1, 2); // Setup stars stars = new Star[NUM_STARS]; for (int i = 0; i < NUM_STARS; i++) { RandomXS128 rand = new RandomXS128(); stars[i] = new Star(rand.nextFloat() * GlobalVars.width, rand.nextFloat() * GlobalVars.height); } shapeRenderer = new ShapeRenderer(); // Setup sound laserShot = Gdx.audio.newSound(Gdx.files.internal("sfx/laser5.mp3")); explode = Gdx.audio.newSound(Gdx.files.internal("sfx/explosion.mp3")); }
From source file:io.piotrjastrzebski.sfg.utils.Assets.java
License:Open Source License
private void finishLoading() { gameAtlas = assetManager.get(GAME_ATLAS, TextureAtlas.class); particleAtlas = assetManager.get(PARTICLE_ATLAS, TextureAtlas.class); uiAtlas = assetManager.get(UI_ATLAS, TextureAtlas.class); skin = assetManager.get(SKIN, Skin.class); skin.getFont("default-font").setMarkupEnabled(true); final ParticleEffectPool explosionParticles = new ParticleEffectPool( assetManager.get(P_EXPLOSION, ParticleEffect.class), 16, Integer.MAX_VALUE); final ParticleEffectPool bloodParticles = new ParticleEffectPool( assetManager.get(P_BLOOD, ParticleEffect.class), 8, Integer.MAX_VALUE); final ParticleEffectPool toxicParticles = new ParticleEffectPool( assetManager.get(P_TOXIC, ParticleEffect.class), 8, Integer.MAX_VALUE); particleEffects = new ObjectMap<Particles, ParticleEffectPool>(); particleEffects.put(Particles.BLOOD, bloodParticles); particleEffects.put(Particles.EXPLOSION, explosionParticles); particleEffects.put(Particles.TOXIC, toxicParticles); bundle = assetManager.get(I18N, I18NBundle.class); loadGameAnimations();//from w w w . j a v a 2s .c o m loadUIAnimations(); soundManager.finishLoading(); }
From source file:net.bplaced.therefactory.nomoore.utils.Particles.java
License:Open Source License
public Particles() { bigFireEffect = new ParticleEffectPool.PooledEffect[5]; smallFireEffect = new ParticleEffectPool.PooledEffect[5]; TextureAtlas textureAtlas = new TextureAtlas("sprites/textures.pack"); ParticleEffect fireworksEffect = new ParticleEffect(); fireworksEffect.load(Gdx.files.internal("particles/fire.p"), textureAtlas); ParticleEffect smallFire = new ParticleEffect(); smallFire.load(Gdx.files.internal("particles/fire_small.p"), textureAtlas); // if particle effect includes additive or pre-multiplied particle emitters // you can turn off blend function clean-up to save a lot of draw calls // but remember to switch the Batch back to GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA // before drawing "regular" sprites or your Stage. fireworksEffect.setEmittersCleanUpBlendFunction(false); smallFire.setEmittersCleanUpBlendFunction(false); bigFirePool = new ParticleEffectPool(fireworksEffect, 1, 5); smallFirePool = new ParticleEffectPool(smallFire, 1, 5); for (int i = 0; i < bigFireEffect.length; i++) { ParticleEffectPool.PooledEffect effect = bigFirePool.obtain(); resetFireworksEffect(effect);/*from w ww. j a v a2 s . c om*/ bigFireEffect[i] = effect; } for (int i = 0; i < smallFireEffect.length; i++) { ParticleEffectPool.PooledEffect effect = smallFirePool.obtain(); resetFireworksEffect(effect); smallFireEffect[i] = effect; } }
From source file:releasethekraken.GameAssets.java
/** * Loads the game assets. Doesn't return until they are all loaded. *///from w ww .j a va 2 s . c o m private void loadAssets() { AssetDescriptor fontMainDesc = new AssetDescriptor(Gdx.files.internal("data/GameFont.fnt"), BitmapFont.class); AssetDescriptor fontDebugDesc = new AssetDescriptor(Gdx.files.internal("data/DebugFont.fnt"), BitmapFont.class); AssetDescriptor fontWorldSmallDesc = new AssetDescriptor(Gdx.files.internal("data/WorldFontSmall.fnt"), BitmapFont.class); this.load(fontMainDesc); this.load(fontDebugDesc); this.load(fontWorldSmallDesc); this.load("entities.png", Texture.class); this.load("hudSprites.png", Texture.class); this.finishLoading(); //Waits until all assets are loaded //Load Particle Effects effectExplosionCannonBall = new ParticleEffect(); effectExplosionCannonBall.load(Gdx.files.internal("effects/Explosion.p"), Gdx.files.internal("effects")); effectExplosionCannonBallPool = new ParticleEffectPool(effectExplosionCannonBall, 1, 20); //Load Shaders pauseBackgroundShader = loadShader("pause"); //Load the pause background shaders ShaderProgram.pedantic = false; //TODO: Change back tilemapShader = loadShader("tilemap"); //Load the tilemap shaders // Configure shader settings. See http://javadocmd.com/blog/libgdx-dynamic-textures-with-pixmap/ tilemapShader.begin(); tilemapShader.setUniformi("u_texture", 0); tilemapShader.setUniformi("u_mask", 1); tilemapShader.end(); //Load Main Texture Files entityTextures = this.get("entities.png", Texture.class); uiTextures = this.get("hudSprites.png", Texture.class); //The multiplier to determine the scale for the text float textScaleMultiplier = Gdx.graphics.getWidth() / 1280.0F; //Main Font fontMain = (BitmapFont) this.get(fontMainDesc); fontMain.getData().setScale(0.5F * textScaleMultiplier); fontMain.getData().markupEnabled = true; //Debug Screen Font fontDebug = (BitmapFont) this.get(fontDebugDesc); fontDebug.getData().setScale(0.25F * textScaleMultiplier); fontDebug.getData().markupEnabled = true; //World Font (unused) fontWorldSmall = ((BitmapFont) this.get(fontWorldSmallDesc)); fontWorldSmall.getData().setScale(1.0F); //TODO: How can this be scaled small enough to be drawn in the world? fontWorldSmall.getData().markupEnabled = true; //Basic Entity Textures entityPlayerTexture = new TextureRegion(entityTextures, 0, 0, 32, 32); entityGunTowerTexture = new TextureRegion(entityTextures, 128, 0, 32, 32); entityPirateBaseTexture = new TextureRegion(entityTextures, 96, 160, 160, 96); entityPirateCannonTexture = new TextureRegion(entityTextures, 160, 0, 32, 32); entityShipCannonTexture = new TextureRegion(entityTextures, 160, 192, 32, 16); entityKrakenBodyTexture = new TextureRegion(entityTextures, 256, 0, 112, 64); entityKrakenTenticle1Texture = new TextureRegion(entityTextures, 368, 0, 48, 16); entityKrakenTenticle2Texture = new TextureRegion(entityTextures, 368, 16, 64, 16); entityKrakenGripperTexture = new TextureRegion(entityTextures, 368, 32, 64, 32); waterSquirtTexture = new TextureRegion(entityTextures, 0, 176, 16, 8); waterBombTexture = new TextureRegion(entityTextures, 0, 192, 32, 32); bulletTexture = new TextureRegion(entityTextures, 16, 176, 16, 16); cannonBallTexture = new TextureRegion(entityTextures, 32, 192, 16, 16); //Fish Textures and Animation entityFishTextures = new TextureRegion[2]; for (int i = 0; i < entityFishTextures.length; i++) entityFishTextures[i] = new TextureRegion(entityTextures, i * 32, 48, 32, 16); entityFishAnimation = new Animation(0.1F, entityFishTextures); entityFishAnimation.setPlayMode(Animation.PlayMode.LOOP); //Fish Textures and Animation 2 entityFishLayer2Textures = new TextureRegion[2]; for (int i = 0; i < entityFishLayer2Textures.length; i++) entityFishLayer2Textures[i] = new TextureRegion(entityTextures, 64 + i * 32, 48, 32, 16); entityFishLayer2Animation = new Animation(0.1F, entityFishLayer2Textures); entityFishLayer2Animation.setPlayMode(Animation.PlayMode.LOOP); //Turtle Textures and Animation entityTurtleTextures = new TextureRegion[2]; for (int i = 0; i < entityTurtleTextures.length; i++) entityTurtleTextures[i] = new TextureRegion(entityTextures, i * 32, 64, 32, 32); entityTurtleAnimation = new Animation(0.2F, entityTurtleTextures); entityTurtleAnimation.setPlayMode(Animation.PlayMode.LOOP); //Orca Textures and Animation entityOrcaTextures = new TextureRegion[2]; for (int i = 0; i < entityOrcaTextures.length; i++) entityOrcaTextures[i] = new TextureRegion(entityTextures, i * 112, 96, 112, 64); entityOrcaAnimation = new Animation(0.5F, entityOrcaTextures); entityOrcaAnimation.setPlayMode(Animation.PlayMode.LOOP); //Shark Textures entitySharkTextures = new TextureRegion[2][2]; for (int i = 0; i < entitySharkTextures.length; i++) for (int j = 0; j < entitySharkTextures[0].length; j++) entitySharkTextures[i][j] = new TextureRegion(entityTextures, 224 + i * 80, 96 + j * 32, 80, 32); //Shark Move Animation TextureRegion[] entitySharkMoveFrames = new TextureRegion[entitySharkTextures.length]; for (int i = 0; i < entitySharkMoveFrames.length; i++) entitySharkMoveFrames[i] = entitySharkTextures[i][0]; entitySharkMoveAnimation = new Animation(0.25F, entitySharkMoveFrames); entitySharkMoveAnimation.setPlayMode(Animation.PlayMode.LOOP); //Shark Attack Animation TextureRegion[] entitySharkAttackFrames = new TextureRegion[entitySharkTextures.length]; for (int i = 0; i < entitySharkAttackFrames.length; i++) entitySharkAttackFrames[i] = entitySharkTextures[i][1]; entitySharkAttackAnimation = new Animation(0.25F, entitySharkAttackFrames); entitySharkAttackAnimation.setPlayMode(Animation.PlayMode.LOOP); //Shark Move and Attack Animation TextureRegion[] entitySharkAttackMoveFrames = new TextureRegion[entitySharkTextures.length * 2]; for (int i = 0; i < entitySharkAttackMoveFrames.length; i++) entitySharkAttackMoveFrames[i] = entitySharkTextures[(int) (i / 2F % 2)][i % 2]; //Magically use all 4 frames entitySharkAttackMoveAnimation = new Animation(0.125F, entitySharkAttackMoveFrames); entitySharkAttackMoveAnimation.setPlayMode(Animation.PlayMode.LOOP); //Sea Shell Textures seaShellTextures = new TextureRegion[6]; for (int i = 0; i < seaShellTextures.length; i++) seaShellTextures[i] = new TextureRegion(entityTextures, 32 + i * 8, 176, 8, 8); //Powerup Textures powerupTextures = new TextureRegion[4]; for (int i = 0; i < powerupTextures.length; i++) powerupTextures[i] = new TextureRegion(uiTextures, i * 32, 0, 32, 32); //UI Icon Textures coinTexture = new TextureRegion(uiTextures, 0, 32, 16, 16); heartTexture = new TextureRegion(uiTextures, 16, 32, 16, 16); strengthTexture = new TextureRegion(uiTextures, 32, 32, 16, 16); clockTexture = new TextureRegion(uiTextures, 48, 32, 16, 16); }