I'm following the example here http://www.bigerstaff.com/
I;ve added another class called Ball, and use an instance of it in this code
public class Ball extends Vector3 {
public Sprite mSprite;
public Texture mTexture;
So instead of using blockTexture and blockSprite
,
blockTexture = new Texture(Gdx.files.internal("data/block.png"));
blockSprite = new Sprite(blockTexture);
I use
ball.mTexture = new Texture(Gdx.files.internal("data/block.png")); //error
ball.mSprite = new Sprite(ball.mTexture); //error
Sorry I am new to Java, but am I missing something very basic here?
Did you create a ball
object ? ball
seems null.
Switch
ball.mSprite = new Sprite(blockTexture);
for
ball.mSprite = new Sprite(ball.mTextture);
you are not creating the blockTexture object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.