mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-09 12:01:21 -04:00
Refactor so that layer group is optionally passed into createClone (and initDrawable) instead of isStage property getting stored on a sprite.
This commit is contained in:
parent
e2ce047fa1
commit
64c8484066
4 changed files with 18 additions and 18 deletions
|
@ -15,6 +15,7 @@ const StringUtil = require('../util/string-util');
|
|||
const specMap = require('./sb2_specmap');
|
||||
const Variable = require('../engine/variable');
|
||||
const MonitorRecord = require('../engine/monitor-record');
|
||||
const StageLayering = require('../engine/stage-layering');
|
||||
|
||||
const {loadCostume} = require('../import/load-costume.js');
|
||||
const {loadSound} = require('../import/load-sound.js');
|
||||
|
@ -327,7 +328,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
|
|||
// Blocks container for this object.
|
||||
const blocks = new Blocks();
|
||||
// @todo: For now, load all Scratch objects (stage/sprites) as a Sprite.
|
||||
const sprite = new Sprite(blocks, runtime, topLevel /* whether this sprite is a stge or not */);
|
||||
const sprite = new Sprite(blocks, runtime);
|
||||
// Sprite/stage name from JSON.
|
||||
if (object.hasOwnProperty('objName')) {
|
||||
sprite.name = topLevel ? 'Stage' : object.objName;
|
||||
|
@ -399,7 +400,7 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip)
|
|||
}
|
||||
|
||||
// Create the first clone, and load its run-state from JSON.
|
||||
const target = sprite.createClone();
|
||||
const target = sprite.createClone(topLevel ? StageLayering.BACKGROUND_LAYER : StageLayering.SPRITE_LAYER);
|
||||
|
||||
const getVariableId = generateVariableIdGetter(target.id, topLevel);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ const vmPackage = require('../../package.json');
|
|||
const Blocks = require('../engine/blocks');
|
||||
const Sprite = require('../sprites/sprite');
|
||||
const Variable = require('../engine/variable');
|
||||
const StageLayering = require('../engine/stage-layering');
|
||||
const log = require('../util/log');
|
||||
const uid = require('../util/uid');
|
||||
|
||||
|
@ -684,7 +685,7 @@ const parseScratchObject = function (object, runtime, extensions, zip) {
|
|||
const blocks = new Blocks();
|
||||
|
||||
// @todo: For now, load all Scratch objects (stage/sprites) as a Sprite.
|
||||
const sprite = new Sprite(blocks, runtime, object.isStage);
|
||||
const sprite = new Sprite(blocks, runtime);
|
||||
|
||||
// Sprite/stage name from JSON.
|
||||
if (object.hasOwnProperty('name')) {
|
||||
|
@ -779,7 +780,7 @@ const parseScratchObject = function (object, runtime, extensions, zip) {
|
|||
// process has been completed.
|
||||
});
|
||||
// Create the first clone, and load its run-state from JSON.
|
||||
const target = sprite.createClone();
|
||||
const target = sprite.createClone(object.isStage ? StageLayering.BACKGROUND_LAYER : StageLayering.SPRITE_LAYER);
|
||||
// Load target properties from JSON.
|
||||
if (object.hasOwnProperty('tempo')) {
|
||||
target.tempo = object.tempo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue