ZKSprite constructor
ZKSprite({})
Implementation
ZKSprite(
{String? image,
String? key,
String? type,
String? json,
double width = 100,
double height = 100})
: super() {
//this.animator = Animator();
if (key != null) {
this.texture = ZKAssets.getAsset(key);
this.textureType = ZKAssets.getType(texture)!;
if (this.texture == null)
throw ("Zerker:: Sorry, this Key '$key' does not get any assets!");
_timer = Timer(Duration(milliseconds: 0), () {
this._loadComplete(this.texture!);
_timer?.cancel();
});
} else if (type != null) {
this.loadSpriteSheet(image!, Size(width, height));
this.textureType = type;
} else if (json != null) {
this.loadAtlas(json, image!);
this.textureType = "atlas";
} else {
this.loadImage(image!);
this.textureType = "image";
}
}