Fix issue where edge-activated hats only run on one sprite when sprite is duplicated or cloned.

This commit is contained in:
Karishma Chadha 2018-12-11 12:28:37 -05:00
parent 532e63da15
commit 19737d4e39
4 changed files with 101 additions and 3 deletions
src/engine

View file

@ -1233,12 +1233,14 @@ class Runtime extends EventEmitter {
/**
* Update an edge-activated hat block value.
* @param {!string} blockId ID of hat to store value for.
* @param {!string} threadTargetId Target ID for the thread that the block belongs to
* @param {*} newValue Value to store for edge-activated hat.
* @return {*} The old value for the edge-activated hat.
*/
updateEdgeActivatedValue (blockId, newValue) {
const oldValue = this._edgeActivatedHatValues[blockId];
this._edgeActivatedHatValues[blockId] = newValue;
updateEdgeActivatedValue (blockId, threadTargetId, newValue) {
const blockAndTargetId = `${blockId}_${threadTargetId}`;
const oldValue = this._edgeActivatedHatValues[blockAndTargetId];
this._edgeActivatedHatValues[blockAndTargetId] = newValue;
return oldValue;
}