From 6a70a5e6c3c9d6694525daf636e9e5a6961b863d Mon Sep 17 00:00:00 2001 From: No-Face-the-3rd Date: Thu, 29 Dec 2022 12:51:37 -0800 Subject: [PATCH] Segment Reset to clear sprites Added resetting of segment sprites when a segment gets reset --- modules/Segments.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/Segments.js b/modules/Segments.js index 1ed7e07..6f959c6 100644 --- a/modules/Segments.js +++ b/modules/Segments.js @@ -15,6 +15,13 @@ export default class Segments */ reset () { + this.segments.forEach((segment) => { + segment.sprites.forEach((sprite) => { + sprite.source.setActive(false); + sprite.source.setVisible(false); + }); + segment.sprites = []; + }); this.segments = [] } @@ -42,7 +49,7 @@ export default class Segments y: y, z: (n + 1 ) * this.scene.segmentLength }, - camera: {}, + camera: {}, screen: {} }, curve: curve, @@ -75,4 +82,4 @@ export default class Segments getSegmentAt (z){ return this.segments.at(z) } -} \ No newline at end of file +}