Separate method building sprite costume image URI

Sprite costume image URI construction moved to a separate method.
This commit is contained in:
Łukasz M 2015-08-28 11:31:44 +02:00
parent 1f4479cc06
commit 474df9671f

View file

@ -113,6 +113,11 @@ var Sprite = function(data) {
this.stacks = [];
};
// Creates a formatted URI for a costume image resource.
Sprite.prototype.formatCostumeImageUri = function(costume, io) {
return io.asset_base + costume.baseLayerMD5 + io.asset_suffix;
};
// Attaches a Sprite (<img>) to a Scratch scene
Sprite.prototype.attach = function(scene) {
// Create textures and materials for each of the costumes.
@ -142,7 +147,7 @@ Sprite.prototype.attach = function(scene) {
})
.attr({
'crossOrigin': 'anonymous',
'src': io.asset_base + this.costumes[c].baseLayerMD5 + io.asset_suffix
'src': this.formatCostumeImageUri(this.costumes[c], io)
});
}