Java Code Examples for com.badlogic.gdx.graphics.g2d.TextureAtlas#findRegion()

The following examples show how to use com.badlogic.gdx.graphics.g2d.TextureAtlas#findRegion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 2
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 3
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 4
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 5
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 6
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example 7
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 8
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PowerupAssets(TextureAtlas atlas) {
    powerup = atlas.findRegion(Constants.POWERUP_SPRITE);
}
 
Example 9
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}
 
Example 10
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}
 
Example 11
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}
 
Example 12
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PlatformAssets(TextureAtlas atlas) {
    AtlasRegion region = atlas.findRegion(Constants.PLATFORM_SPRITE);
    int edge = Constants.PLATFORM_EDGE;
    platformNinePatch = new NinePatch(region, edge, edge, edge, edge);
}
 
Example 13
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PowerupAssets(TextureAtlas atlas) {
    powerup = atlas.findRegion(Constants.POWERUP_SPRITE);
}
 
Example 14
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PlatformAssets(TextureAtlas atlas) {
    AtlasRegion region = atlas.findRegion(Constants.PLATFORM_SPRITE);
    int edge = Constants.PLATFORM_EDGE;
    platformNinePatch = new NinePatch(region, edge, edge, edge, edge);
}
 
Example 15
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public BulletAssets(TextureAtlas atlas) {
    bullet = atlas.findRegion(Constants.BULLET_SPRITE);
}
 
Example 16
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PlatformAssets(TextureAtlas atlas) {
    AtlasRegion region = atlas.findRegion(Constants.PLATFORM_SPRITE);
    int edge = Constants.PLATFORM_EDGE;
    platformNinePatch = new NinePatch(region, edge, edge, edge, edge);
}
 
Example 17
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public PlatformAssets(TextureAtlas atlas) {
    AtlasRegion region = atlas.findRegion(Constants.PLATFORM_SPRITE);
    int edge = Constants.PLATFORM_EDGE;
    platformNinePatch = new NinePatch(region, edge, edge, edge, edge);
}
 
Example 18
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}
 
Example 19
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}
 
Example 20
Source File: Assets.java    From ud406 with MIT License 4 votes vote down vote up
public EnemyAssets(TextureAtlas atlas) {
    enemy = atlas.findRegion(Constants.ENEMY_SPRITE);
}