mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-06 19:41:51 -04:00
Stage, costumes, backdrops (#149)
* Add `Clone.prototype.getCostumeIndexByName`, keep in range * Add basic costume primitives from Scratch 2.0 * Add costume getter block * Add properties and methods for distinguishing stage and sprites-vs-clones * Add backdrop-related looks blocks * Fix up "switch to backdrop" to be working * Costume/backdrop reporters are 1-indexed * Fire "when backdrop switched" hats * Cut cloning helpers for a separate PR * Disable many blocks on the stage * Refactor into _setCostumeOrBackdrop; implement switch backdrop and wait * Fire hats even when backdrop unchanged
This commit is contained in:
parent
14feb64005
commit
797f844de3
5 changed files with 183 additions and 7 deletions
src/engine
|
@ -434,6 +434,19 @@ Runtime.prototype.getTargetById = function (targetId) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a target representing the Scratch stage, if one exists.
|
||||
* @return {?Target} The target, if found.
|
||||
*/
|
||||
Runtime.prototype.getTargetForStage = function () {
|
||||
for (var i = 0; i < this.targets.length; i++) {
|
||||
var target = this.targets[i];
|
||||
if (target.isStage) {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle an animation frame from the main thread.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue