So, i'm currently working on a game in LibGDX.
I've got a class, "GraphicSprite" that extends Sprite.
public class GraphicSprite extends Sprite{
public GraphicSprite(Texture texture){
//WHERE WOULD I IMPORT THE TEXTURE TO THE SPRITE THAT'S BEING EXTENDED?
//SHOULD BE SOMETHING LIKE THIS? "this.(classBeingExtended) = new Sprite(texture);
}
}
When creating a SPRITE, you have to input some variables.
testSprite = new Sprite(TEXTURE HERE);
But, I want to create GraphicSprites (which extend Sprite). So if I do :
testGraphicSprite = new GraphicSprite(new Texture(".."));
How would I set the texture?
在构造函数中,只需先调用“ super”构造函数即可。
super(texture);
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.