From 4419014421c40886c18c3738a0d0c27a55eeef5c Mon Sep 17 00:00:00 2001 From: Kenny2github Date: Sat, 5 May 2018 18:25:18 +0800 Subject: [PATCH] Handle random backdrop --- src/blocks/scratch3_looks.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 92500ac03..2f5a661e0 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -343,6 +343,8 @@ class Scratch3LooksBlocks { } else if (requestedCostume === 'next costume' || requestedCostume === 'next backdrop') { target.setCostume(target.currentCostume + 1); + } else if (requestedCostume === 'random backdrop') { + target.setCostume(Math.floor(Math.random() * target.getCostumes().length)); } else { const forcedNumber = Number(requestedCostume); if (!isNaN(forcedNumber)) {