Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.TextureRegion


            getTextureData().consumePixmap().dispose();
          }
        };
        tex.setFilter(parameter.minFilter, parameter.magFilter);

        data.regions[i] = new TextureRegion(tex);
      }
    }
    return data;
  }
View Full Code Here


      engine.addSystem(new RenderSystem(camera));
      engine.addSystem(new MovementSystem());
     
      Entity crate = engine.createEntity();
      crate.add(new PositionComponent(50, 50));
      crate.add(new VisualComponent(new TextureRegion(crateTexture)));

      engine.addEntity(crate);
     
      TextureRegion coinRegion = new TextureRegion(coinTexture);
     
      for(int i=0; i<100; i++){
        Entity coin = engine.createEntity();
        coin.add(new PositionComponent(MathUtils.random(640), MathUtils.random(480)));
        coin.add(new MovementComponent(10.0f, 10.0f));
View Full Code Here

    shipSheet = new Texture(Gdx.files.internal("data/spritesheets/CharacterSheet.png"));
    enemySheet = new Texture(Gdx.files.internal("data/spritesheets/EnemySheet.png"));
    projectileSheet = new Texture(Gdx.files.internal("data/spritesheets/ProjectileSheet.png"));
    bossSheet = new Texture(Gdx.files.internal("data/spritesheets/BossSheet.png"));

    frameTexture = new TextureRegion(new Texture("data/screens/frame.png"));

    // set sprite sheet to work with to shipSheet
    TextureRegion[][] tmp = TextureRegion.split(shipSheet, shipSheet.getWidth() / shipSheetTileWidth * 3,
        shipSheet.getHeight() / shipSheetTileHeight * 3);
    shipFrames = new TextureRegion[3]; // number of frames for the animation
                      // counting from 0
    shipMoveFrames = new TextureRegion[4];

    // place all ship frames into array
    //
    int index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shipFrames[index++] = tmp[i][j];
      }
    }
    // place all ship turing frams into array
    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    shipBasicBullet = new TextureRegion(shipSheet, 64, 224, 48, 16);

    shipAnimation = new Animation(.2f, shipFrames);
    shipMoveAnimation = new Animation(.2f, shipMoveFrames);

    // switch sprite sheet to enemySheet
    tmp = TextureRegion.split(enemySheet, enemySheet.getWidth() / 16, enemySheet.getHeight() / 16);

    // place enemy bulletFrames into array sprite sheet

    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 6; i < 7; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletBlue", enemyBasicBulletAnimation);
    // red enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 4; i < 5; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletRed", enemyBasicBulletAnimation);

    // green enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 5; i < 6; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletGreen", enemyBasicBulletAnimation);

    // place enemy frames into array from sprite sheet
    // blue shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterBlue", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterBlueMove", shooterMoveAnimation);

    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    // red shooter animation
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterRed", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterRedMove", shooterMoveAnimation);

    // green shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterGreen", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterGreenMove", shooterMoveAnimation);

    shipSlow = new TextureRegion(projectileSheet, 288, 128, 64, 64);

    Follower = new TextureRegion(enemySheet, 1, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerRed", followerAnimation);

    Follower = new TextureRegion(enemySheet, 65, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerBlue", followerAnimation);

    Follower = new TextureRegion(enemySheet, 33, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerGreen", followerAnimation);
    ;

    basicExplosion = new TextureRegion(enemySheet, 1, 224, 32, 32);
    textures.put("basicExplosionRed", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 65, 224, 32, 32);
    textures.put("basicExplosionBlue", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 33, 224, 32, 32);
    textures.put("basicExplosionGreen", basicExplosion);

    // place enemy bulletFrames into array sprite sheet
    bossWaitFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossWaitFrames[index++] = new TextureRegion(bossSheet, j * 48, 0*64, 48, 64);
    }
    bossWaitAnimation = new Animation(.15f, bossWaitFrames);
    animations.put("BossOneWait", bossWaitAnimation);

    bossMoveFrames = new TextureRegion[3];
    index = 0;
    for (int j = 0; j < 3; j++) {
      bossMoveFrames[index++] = new TextureRegion(bossSheet, j * 48, 1*64, 48, 64);
    }
    bossMoveAnimation = new Animation(.15f, bossMoveFrames);
    animations.put("BossOneMove", bossMoveAnimation);
   
    bossAttackFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossAttackFrames[index++] = new TextureRegion(bossSheet, j * 48, 2*64, 48, 64);
    }
    bossAttackAnimation = new Animation(.15f, bossAttackFrames);
    animations.put("BossOneAttack", bossAttackAnimation);

    bomb = new TextureRegion(projectileSheet, 695, 28, 256, 256);

    powerItem = new TextureRegion(projectileSheet, 320, 80, 16, 16);
    bombItem = new TextureRegion(projectileSheet, 336, 80, 16, 16);
    pointsItem = new TextureRegion(projectileSheet, 306, 82, 12, 12);
   
    bossHealthBar = new TextureRegion(projectileSheet, 34, 18, 14, 14);
    textures.put("healthBar", bossHealthBar);
   
    animations.put("Ship", shipAnimation);
    animations.put("ShipMove", shipMoveAnimation);

View Full Code Here

    shipSheet = new Texture(Gdx.files.internal("data/spritesheets/CharacterSheet.png"));
    enemySheet = new Texture(Gdx.files.internal("data/spritesheets/EnemySheet.png"));
    projectileSheet = new Texture(Gdx.files.internal("data/spritesheets/ProjectileSheet.png"));
    bossSheet = new Texture(Gdx.files.internal("data/spritesheets/BossSheet.png"));

    frameTexture = new TextureRegion(new Texture("data/screens/frame.png"));

    // set sprite sheet to work with to shipSheet
    TextureRegion[][] tmp = TextureRegion.split(shipSheet, shipSheet.getWidth() / shipSheetTileWidth * 3,
        shipSheet.getHeight() / shipSheetTileHeight * 3);
    shipFrames = new TextureRegion[3]; // number of frames for the animation
                      // counting from 0
    shipMoveFrames = new TextureRegion[4];

    // place all ship frames into array
    //
    int index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shipFrames[index++] = tmp[i][j];
      }
    }
    // place all ship turing frams into array
    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    shipBasicBullet = new TextureRegion(shipSheet, 64, 224, 48, 16);

    shipAnimation = new Animation(.2f, shipFrames);
    shipMoveAnimation = new Animation(.2f, shipMoveFrames);

    // switch sprite sheet to enemySheet
    tmp = TextureRegion.split(enemySheet, enemySheet.getWidth() / 16, enemySheet.getHeight() / 16);

    // place enemy bulletFrames into array sprite sheet

    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 6; i < 7; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletBlue", enemyBasicBulletAnimation);
    // red enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 4; i < 5; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletRed", enemyBasicBulletAnimation);

    // green enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 5; i < 6; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletGreen", enemyBasicBulletAnimation);

    // place enemy frames into array from sprite sheet
    // blue shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterBlue", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterBlueMove", shooterMoveAnimation);

    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    // red shooter animation
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterRed", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterRedMove", shooterMoveAnimation);

    // green shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterGreen", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterGreenMove", shooterMoveAnimation);

    shipSlow = new TextureRegion(projectileSheet, 288, 128, 64, 64);

    Follower = new TextureRegion(enemySheet, 1, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerRed", followerAnimation);

    Follower = new TextureRegion(enemySheet, 65, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerBlue", followerAnimation);

    Follower = new TextureRegion(enemySheet, 33, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerGreen", followerAnimation);
    ;

    basicExplosion = new TextureRegion(enemySheet, 1, 224, 32, 32);
    textures.put("basicExplosionRed", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 65, 224, 32, 32);
    textures.put("basicExplosionBlue", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 33, 224, 32, 32);
    textures.put("basicExplosionGreen", basicExplosion);

    // place enemy bulletFrames into array sprite sheet
    bossWaitFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossWaitFrames[index++] = new TextureRegion(bossSheet, j * 48, 0, 48, 64);
    }
    bossWaitAnimation = new Animation(.15f, bossWaitFrames);
    animations.put("BossOneWait", bossWaitAnimation);

    bossMoveFrames = new TextureRegion[3];
    index = 0;
    for (int j = 0; j < 3; j++) {
      bossMoveFrames[index++] = new TextureRegion(bossSheet, j * 48, 1 * 64, 48, 64);
    }
    bossMoveAnimation = new Animation(.15f, bossMoveFrames);
    animations.put("BossOneMove", bossMoveAnimation);

    bossAttackFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossAttackFrames[index++] = new TextureRegion(bossSheet, j * 48, 2 * 64, 48, 64);
    }
    bossAttackAnimation = new Animation(.15f, bossAttackFrames);
    animations.put("BossOneAttack", bossAttackAnimation);

    bossHealthBar = new TextureRegion(projectileSheet, 34, 18, 14, 14);
    textures.put("healthBar", bossHealthBar);

    bomb = new TextureRegion(projectileSheet, 695, 28, 256, 256);

    powerItem = new TextureRegion(projectileSheet, 320, 80, 16, 16);
    bombItem = new TextureRegion(projectileSheet, 336, 80, 16, 16);
    pointsItem = new TextureRegion(projectileSheet, 306, 82, 12, 12);

    animations.put("Ship", shipAnimation);
    animations.put("ShipMove", shipMoveAnimation);

    textures.put("shipBasicBullet", shipBasicBullet);
View Full Code Here

    bulletIterator = enemyBullets.iterator();
    while (bulletIterator.hasNext()) {
      bullet = bulletIterator.next();
      currentFrame = world.level.getAnimation(bullet.getSpriteName()).getKeyFrame(bullet.getTime(), true);

      TextureRegion image = new TextureRegion(currentFrame);

      Image object = new Image(image);
      object.setPosition(bullet.getPosition().x - (currentFrame.getRegionWidth() / 2) + bullet.getWidth() / 2f,
          (bullet.getPosition().y - currentFrame.getRegionHeight() / 2) + bullet.getHeight() / 2);
      object.setOrigin(currentFrame.getRegionWidth() / 2, currentFrame.getRegionHeight() / 2);
View Full Code Here

    } else {
      currentFrame = world.level.getAnimation(ship.getSpriteName()).getKeyFrame(ship.getTime(), true);
      currentFrame.flip(false, false);

    }
    TextureRegion image = new TextureRegion(currentFrame);
    Image object = new Image(image);

    object.setPosition(ship.getPosition().x + ship.getWidth() / 3 - currentFrame.getRegionWidth() / 2,
        ship.getPosition().y + ship.getHeight() / 3 - currentFrame.getRegionHeight() / 2);
    object.setOrigin(currentFrame.getRegionWidth() / 2, currentFrame.getRegionHeight() / 2);
    object.setWidth(currentFrame.getRegionWidth());
    object.setHeight(currentFrame.getRegionHeight());
    object.setScale(ship.getRenderScaleX(), ship.getRenderScaleY());
    object.setRotation(ship.getRotation());
 

    if (ship.isDead()) {
      object.setColor(1, 1, 1, ship.getAlpha());
    }

    stage.addActor(object);

 
    if (ship.isSLOW()) {

      TextureRegion slowSprite = new TextureRegion(world.level.getTexture("shipSlow"));
      Image slow = new Image(slowSprite);

      slow.setPosition(ship.getPosition().x + ship.getWidth() / 2 - slowSprite.getRegionWidth() / 2,
          ship.getPosition().y + ship.getHeight() / 2 - slowSprite.getRegionHeight() / 2);
      slow.setOrigin(slowSprite.getRegionWidth() / 2, slowSprite.getRegionHeight() / 2);
      slow.setWidth(slowSprite.getRegionWidth());
      slow.setHeight(slowSprite.getRegionHeight());
      slow.setScale(ship.getRenderScaleX(), ship.getRenderScaleY());
      slow.setRotation(ship.getSlowEffectRotation());
     
      stage.addActor(slow);
    }
View Full Code Here

        currentFrame = world.level.getAnimation(enemy.getSpriteName()).getKeyFrame(enemy.getTime(), true);
        if (currentFrame.isFlipX()) {
          currentFrame.flip(true, false);
        }
      }
      TextureRegion image = new TextureRegion(currentFrame);

      Image object = new Image(image);
      object.setPosition(enemy.getPosition().x + enemy.getWidth() / 2 - currentFrame.getRegionWidth() / 2,
          enemy.getPosition().y + enemy.getHeight() / 2 - currentFrame.getRegionHeight() / 2);
      object.setOrigin(currentFrame.getRegionWidth() / 2, currentFrame.getRegionHeight() / 2);
View Full Code Here

    shipSheet = new Texture(Gdx.files.internal("data/spritesheets/CharacterSheet.png"));
    enemySheet = new Texture(Gdx.files.internal("data/spritesheets/EnemySheet.png"));
    projectileSheet = new Texture(Gdx.files.internal("data/spritesheets/ProjectileSheet.png"));
    bossSheet = new Texture(Gdx.files.internal("data/spritesheets/BossSheet.png"));

    frameTexture = new TextureRegion(new Texture("data/screens/frame.png"));

    // set sprite sheet to work with to shipSheet
    TextureRegion[][] tmp = TextureRegion.split(shipSheet, shipSheet.getWidth() / shipSheetTileWidth * 3,
        shipSheet.getHeight() / shipSheetTileHeight * 3);
    shipFrames = new TextureRegion[3]; // number of frames for the animation
                      // counting from 0
    shipMoveFrames = new TextureRegion[4];

    // place all ship frames into array
    //
    int index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shipFrames[index++] = tmp[i][j];
      }
    }
    // place all ship turing frams into array
    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    index = 0;
    for (int i = 3; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        shipMoveFrames[index++] = tmp[i][j];
      }
    }

    shipBasicBullet = new TextureRegion(shipSheet, 64, 224, 48, 16);

    shipAnimation = new Animation(.2f, shipFrames);
    shipMoveAnimation = new Animation(.2f, shipMoveFrames);

    // switch sprite sheet to enemySheet
    tmp = TextureRegion.split(enemySheet, enemySheet.getWidth() / 16, enemySheet.getHeight() / 16);

    // place enemy bulletFrames into array sprite sheet

    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 6; i < 7; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletBlue", enemyBasicBulletAnimation);
    // red enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 4; i < 5; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletRed", enemyBasicBulletAnimation);

    // green enemy bullets
    index = 0;
    enemyBasicBulletFrames = new TextureRegion[7];
    for (int i = 5; i < 6; i++) {
      for (int j = 8; j < 15; j++) {
        enemyBasicBulletFrames[index++] = tmp[i][j];
      }
    }
    enemyBasicBulletAnimation = new Animation(.15f, enemyBasicBulletFrames);
    animations.put("enemyBasicBulletGreen", enemyBasicBulletAnimation);

    // place enemy frames into array from sprite sheet
    // blue shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterBlue", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 0; i < 1; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterBlueMove", shooterMoveAnimation);

    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    // red shooter animation
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterRed", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 1; i < 2; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterRedMove", shooterMoveAnimation);

    // green shooter animations
    shooterFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        shooterFrames[index++] = tmp[i][j];
      }
    }
    shooterAnimation = new Animation(.2f, shooterFrames);
    animations.put("ShooterGreen", shooterAnimation);

    shooterMoveFrames = new TextureRegion[3];
    index = 0;
    for (int i = 2; i < 3; i++) {
      for (int j = 4; j < 7; j++) {
        shooterMoveFrames[index++] = tmp[i][j];
      }
    }
    shooterMoveAnimation = new Animation(.2f, shooterMoveFrames);
    animations.put("ShooterGreenMove", shooterMoveAnimation);

    shipSlow = new TextureRegion(projectileSheet, 288, 128, 64, 64);

    Follower = new TextureRegion(enemySheet, 1, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerRed", followerAnimation);

    Follower = new TextureRegion(enemySheet, 65, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerBlue", followerAnimation);

    Follower = new TextureRegion(enemySheet, 33, 192, 32, 32);
    followerAnimation = new Animation(1f, Follower);
    animations.put("FollowerGreen", followerAnimation);
    ;

    basicExplosion = new TextureRegion(enemySheet, 1, 224, 32, 32);
    textures.put("basicExplosionRed", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 65, 224, 32, 32);
    textures.put("basicExplosionBlue", basicExplosion);

    basicExplosion = new TextureRegion(enemySheet, 33, 224, 32, 32);
    textures.put("basicExplosionGreen", basicExplosion);

    // place enemy bulletFrames into array sprite sheet
    bossWaitFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossWaitFrames[index++] = new TextureRegion(bossSheet, j * 48, 0, 48, 64);
    }
    bossWaitAnimation = new Animation(.15f, bossWaitFrames);
    animations.put("BossOneWait", bossWaitAnimation);

    bossMoveFrames = new TextureRegion[3];
    index = 0;
    for (int j = 0; j < 3; j++) {
      bossMoveFrames[index++] = new TextureRegion(bossSheet, j * 48, 1 * 64, 48, 64);
    }
    bossMoveAnimation = new Animation(.15f, bossMoveFrames);
    animations.put("BossOneMove", bossMoveAnimation);

    bossAttackFrames = new TextureRegion[4];
    index = 0;
    for (int j = 0; j < 4; j++) {
      bossAttackFrames[index++] = new TextureRegion(bossSheet, j * 48, 2 * 64, 48, 64);
    }
    bossAttackAnimation = new Animation(.15f, bossAttackFrames);
    animations.put("BossOneAttack", bossAttackAnimation);

    bossHealthBar = new TextureRegion(projectileSheet, 34, 18, 14, 14);
    textures.put("healthBar", bossHealthBar);

    bomb = new TextureRegion(projectileSheet, 695, 28, 256, 256);

    powerItem = new TextureRegion(projectileSheet, 320, 80, 16, 16);
    bombItem = new TextureRegion(projectileSheet, 336, 80, 16, 16);
    pointsItem = new TextureRegion(projectileSheet, 306, 82, 12, 12);

    animations.put("Ship", shipAnimation);
    animations.put("ShipMove", shipMoveAnimation);

    textures.put("shipBasicBullet", shipBasicBullet);
View Full Code Here

        int spriteWidth = texture.getWidth() / columns;
        int spriteHeight = texture.getHeight() / rows;

        for (int y = 0; y < rows; y++) {
            for (int x = 0; x < columns; x++) {
                TextureRegion textureRegion = new TextureRegion(
                          texture
                        , 0 + (x * spriteWidth)
                        , 0 + (y * spriteHeight)
                        , spriteWidth
                        , spriteHeight);
View Full Code Here

        Page p = pages.get(i);
       
        Texture tex = new Texture(p.getPixmap(), p.getPixmap().getFormat(), false);
        tex.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
       
        data.regions[i] = new TextureRegion(tex);
      }
     
      //no more need for the PixmapPacker.. we can dispose it
      packer.dispose();
    }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.TextureRegion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.