@@ -619,7 +619,6 @@ export class GolfScene extends Phaser.Scene {
619619
620620 const action : GolfAction = { drawSource : this . drawSource , move } ;
621621 this . setPhase ( 'animating' ) ;
622- this . hideDrawnCard ( ) ;
623622
624623 const result = executeTurn ( this . session , action ) ;
625624 this . recorder . recordTurn ( result , action . drawSource ) ;
@@ -666,7 +665,6 @@ export class GolfScene extends Phaser.Scene {
666665
667666 // Pause so the player can see the drawn card, then execute the move
668667 this . time . delayedCall ( AI_SHOW_DRAW_DELAY , ( ) => {
669- this . hideDrawnCard ( ) ;
670668 this . setPhase ( 'animating' ) ;
671669 const result = executeTurn ( this . session , action ) ;
672670 this . recorder . recordTurn ( result , action . drawSource ) ;
@@ -711,6 +709,14 @@ export class GolfScene extends Phaser.Scene {
711709 const playerKey = result . playerIndex === 0 ? 'human' : 'ai' ;
712710 const sprites = playerKey === 'human' ? this . humanCardSprites : this . aiCardSprites ;
713711
712+ // Wrap the caller's onComplete to clean up the drawn card sprite first.
713+ // The drawn card persists on-screen during the animation so that future
714+ // animation improvements can tween it to its destination.
715+ const wrappedOnComplete = ( ) => {
716+ this . hideDrawnCard ( ) ;
717+ onComplete ( ) ;
718+ } ;
719+
714720 if ( result . move . kind === 'swap' ) {
715721 const idx = result . move . row * 3 + result . move . col ;
716722 const sprite = sprites [ idx ] ;
@@ -729,7 +735,7 @@ export class GolfScene extends Phaser.Scene {
729735 scaleX : 1 ,
730736 duration : ANIM_DURATION / 2 ,
731737 ease : 'Power2' ,
732- onComplete,
738+ onComplete : wrappedOnComplete ,
733739 } ) ;
734740 } ,
735741 } ) ;
@@ -751,7 +757,7 @@ export class GolfScene extends Phaser.Scene {
751757 scaleX : 1 ,
752758 duration : ANIM_DURATION / 2 ,
753759 ease : 'Power2' ,
754- onComplete,
760+ onComplete : wrappedOnComplete ,
755761 } ) ;
756762 } ,
757763 } ) ;
0 commit comments