File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class Dog extends Character {
4343 ] ;
4444 super ( 'dog' , options . spritesheet , states ) ;
4545 this . toRetrieve = 0 ;
46+ this . maxRetrieve = 3 ;
4647 this . anchor . set ( 0.5 , 0 ) ;
4748 this . options = options ;
4849 this . sniffSoundId = null ;
@@ -191,8 +192,11 @@ class Dog extends Character {
191192 * @retuns {Dog}
192193 */
193194 retrieve ( ) {
195+ // To avoid ridiculous chains of animations that last forever we can limit this a bit
196+ if ( this . toRetrieve + 1 >= this . maxRetrieve ) {
197+ return this ;
198+ }
194199 this . toRetrieve ++ ;
195-
196200 this . upDownTween ( {
197201 onStart : ( ) => {
198202 if ( this . toRetrieve >= 2 ) {
@@ -212,10 +216,10 @@ class Dog extends Character {
212216 * @returns {Dog }
213217 */
214218 laugh ( ) {
219+ this . toRetrieve = 0 ;
215220 this . upDownTween ( {
216221 state : 'laugh' ,
217222 onStart : ( ) => {
218- this . toRetrieve = 0 ;
219223 this . state = 'laugh' ;
220224 sound . play ( 'laugh' ) ;
221225 }
Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ class Stage extends Container {
220220 * @returns {Promise } - This promise is resolved when all the ducks have flown away
221221 */
222222 flyAway ( ) {
223+ this . dog . stopAndClearTimeline ( )
223224 this . dog . laugh ( ) ;
224225
225226 const duckPromises = [ ] ;
You can’t perform that action at this time.
0 commit comments