2017-12-28 38 views
1

私はこのエラーになっています:TextureRegion.split Androidのスタジオエラー

を:私は取得していますビルドし、私はあまりにもTextureRegionを宣言した

rollSpriteSheet = new TextureRegion.split(new Texture("ship.png"),Constants.SHIP_WIDTH_PIXEL,Constants.SHIP_HEIGHT_PIXEL); 

ライン用とメッセージのGradleで「シンボルを解決できない 『スプリット』を」

Error:(35, 45) error: cannot find symbol class split 

これは私のコードです:

public class ShapexScreen extends InputAdapter implements Screen { 
    public static final String TAG = ShapexScreen.class.getName(); 
    float x; 
    float y; 
    Animation[] rolls; 
    TextureRegion[][] rollSpriteSheet; 
    int roll; 
    float stateTime; //statetime is adding delta time every frame 
    Foflex game; 

    public ShapexScreen(Foflex game){ 
     this.game = game; 
     y = 15; 
     x = Constants.SCREEN_WIDTH /2 - Constants.SCREEN_WIDTH /2; 
     roll = 2; //roll 2 would be in middle 
     rolls = new Animation[5]; //Five different roll states 
     rollSpriteSheet = new TextureRegion.split(new Texture("ship.png"),Constants.SHIP_WIDTH_PIXEL,Constants.SHIP_HEIGHT_PIXEL); //2d array to store the ship sprite sheet 
     rolls[roll] = new Animation(Constants.ANIMATION_SPEED, rollSpriteSheet[0]); 
    } 

答えて

1

TextureRegion

Defines a rectangular area of a texture. The coordinate system used has its origin in the upper left corner with the x-axis pointing to the right and the y axis pointing downwards.

Error:(35, 45) error: cannot find symbol class split 

あなたはそれを助けた

rollSpriteSheet = TextureRegion.split(new Texture("ship.png"),Constants.SHIP_WIDTH_PIXEL,Constants.SHIP_HEIGHT_PIXEL); 

FYI

public TextureRegion[][] split(int tileWidth, 
           int tileHeight) 

Helper function to create tiles out of this TextureRegion starting from the top left corner going to the right and ending at the bottom right corner. Only complete tiles will be returned so if the region's width or height are not a multiple of the tile width and height not all of the region will be used. This will not work on texture regions returned form a TextureAtlas that either have whitespace removed or where flipped before the region is split.

+1

この方法を呼び出す必要があります。ありがとうございました。 – sukhdeep

関連する問題