mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-01 17:11:21 -04:00
Clones (#150)
* Provide property to Clone to distinguish "original" clones * Provide method to clone a clone's properties * Don't report clones in the UI target list * Add target info to Thread * Allow hats to skip clones (for green flag) * Green flag skips clones * Implement "create clone" and hat * Pass the runtime to sprites and clones (for start hats) * Clone disposal; trigger hats after drawable initializes. * Separate stop threads for target; fix handling of stop button * Remove extraneous `skipClones` property * Add global clone limit * Don't allow a non-clone to delete itself. * Rename `cloneClone` -> `makeClone` * Variable updates in runtime.js * Synchronous drawable initialization (until we put it back to promises)
This commit is contained in:
parent
542899949e
commit
9744bcbb70
10 changed files with 229 additions and 37 deletions
src/engine
|
@ -29,6 +29,12 @@ function Thread (firstBlock) {
|
|||
*/
|
||||
this.status = 0; /* Thread.STATUS_RUNNING */
|
||||
|
||||
/**
|
||||
* Target of this thread.
|
||||
* @type {?Target}
|
||||
*/
|
||||
this.target = null;
|
||||
|
||||
/**
|
||||
* Whether the thread requests its script to glow during this frame.
|
||||
* @type {boolean}
|
||||
|
@ -145,4 +151,20 @@ Thread.prototype.setStatus = function (status) {
|
|||
this.status = status;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set thread target.
|
||||
* @param {?Target} target Target for this thread.
|
||||
*/
|
||||
Thread.prototype.setTarget = function (target) {
|
||||
this.target = target;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get thread target.
|
||||
* @return {?Target} Target for this thread, if available.
|
||||
*/
|
||||
Thread.prototype.getTarget = function () {
|
||||
return this.target;
|
||||
};
|
||||
|
||||
module.exports = Thread;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue