From d10ba11c8f13fccc79554bcdee90fbddf892b064 Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Wed, 28 Sep 2016 16:43:12 -0400 Subject: [PATCH] Round costume values (#221) --- src/import/sb2import.js | 2 +- src/sprites/clone.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/import/sb2import.js b/src/import/sb2import.js index 0962074e..dfa6d25e 100644 --- a/src/import/sb2import.js +++ b/src/import/sb2import.js @@ -108,7 +108,7 @@ function parseScratchObject (object, runtime, topLevel) { target.visible = object.visible; } if (object.hasOwnProperty('currentCostumeIndex')) { - target.currentCostume = object.currentCostumeIndex; + target.currentCostume = Math.round(object.currentCostumeIndex); } target.isStage = topLevel; target.updateAllDrawableProperties(); diff --git a/src/sprites/clone.js b/src/sprites/clone.js index ef7f5892..f94015c6 100644 --- a/src/sprites/clone.js +++ b/src/sprites/clone.js @@ -230,6 +230,7 @@ Clone.prototype.clearEffects = function () { */ Clone.prototype.setCostume = function (index) { // Keep the costume index within possible values. + index = Math.round(index); this.currentCostume = MathUtil.wrapClamp( index, 0, this.sprite.costumes.length - 1 );