Merge pull request #933 from ericrosenbaum/bugfix/handle-sprites-named-stage

When getting sprite by name, skip the stage
This commit is contained in:
Eric Rosenbaum 2018-02-13 19:44:04 -05:00 committed by GitHub
commit a8e2972a7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1458,6 +1458,9 @@ class Runtime extends EventEmitter {
getSpriteTargetByName (spriteName) { getSpriteTargetByName (spriteName) {
for (let i = 0; i < this.targets.length; i++) { for (let i = 0; i < this.targets.length; i++) {
const target = this.targets[i]; const target = this.targets[i];
if (target.isStage) {
continue;
}
if (target.sprite && target.sprite.name === spriteName) { if (target.sprite && target.sprite.name === spriteName) {
return target; return target;
} }