mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-03 00:54:57 -04:00
Round costume values (#221)
This commit is contained in:
parent
a585a08a93
commit
d10ba11c8f
2 changed files with 2 additions and 1 deletions
src
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue