mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-09 12:33:58 -04:00
Clear graphic effects on green flag (#199)
This commit is contained in:
parent
f9efc2b4bc
commit
aa5e8d2648
3 changed files with 18 additions and 0 deletions
src
|
@ -382,6 +382,10 @@ Runtime.prototype.greenFlag = function () {
|
||||||
this.stopAll();
|
this.stopAll();
|
||||||
this.ioDevices.clock.resetProjectTimer();
|
this.ioDevices.clock.resetProjectTimer();
|
||||||
this.clearEdgeActivatedValues();
|
this.clearEdgeActivatedValues();
|
||||||
|
// Inform all targets of the green flag.
|
||||||
|
for (var i = 0; i < this.targets.length; i++) {
|
||||||
|
this.targets[i].onGreenFlag();
|
||||||
|
}
|
||||||
this.startHats('event_whenflagclicked');
|
this.startHats('event_whenflagclicked');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,12 @@ function Target (blocks) {
|
||||||
this.blocks = blocks;
|
this.blocks = blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the project receives a "green flag."
|
||||||
|
* @abstract
|
||||||
|
*/
|
||||||
|
Target.prototype.onGreenFlag = function () {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a human-readable name for this target.
|
* Return a human-readable name for this target.
|
||||||
* Target implementations should override this.
|
* Target implementations should override this.
|
||||||
|
|
|
@ -332,6 +332,14 @@ Clone.prototype.makeClone = function () {
|
||||||
return newClone;
|
return newClone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the project receives a "green flag."
|
||||||
|
* For a clone, this clears graphic effects.
|
||||||
|
*/
|
||||||
|
Clone.prototype.onGreenFlag = function () {
|
||||||
|
this.clearEffects();
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose of this clone, destroying any run-time properties.
|
* Dispose of this clone, destroying any run-time properties.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue