@@ -32,6 +32,9 @@ const WATCHED_RANGES = [0, 1, 2];
3232
3333const SIZE = constants . SIZE ;
3434const FRAMES = constants . FRAMES ;
35+
36+ // Scale factor make the generated dancer appear the same size as other dance sprites.
37+ // At 1.0 scale, the rendered frame takes up the entire canvas.
3538const GENERATED_DANCER_SCALE = 0.75 ;
3639
3740// NOTE: min and max are inclusive
@@ -325,9 +328,7 @@ module.exports = class DanceParty {
325328 backgroundEffect . reset ( ) ;
326329 }
327330
328- if ( this . generatedDancer ) {
329- this . generatedDancer . setSource ( null ) ;
330- }
331+ this . setGeneratedDancerMove ( 'rest' ) ;
331332
332333 let foregroundEffect = this . getForegroundEffect ( ) ;
333334 if ( foregroundEffect && foregroundEffect . reset ) {
@@ -794,10 +795,6 @@ module.exports = class DanceParty {
794795 if ( ! this . spriteExists_ ( sprite ) ) {
795796 return ;
796797 }
797- if ( sprite . isGenDancer ) {
798- this . generatedDancer . setSource ( move ) ;
799- return ;
800- }
801798 // Number of valid full length moves
802799 const { fullLengthMoveCount} = this . world ;
803800 if ( typeof move === 'number' ) {
@@ -809,12 +806,17 @@ module.exports = class DanceParty {
809806 }
810807 sprite . mirroring = dir ;
811808 sprite . mirrorX ( dir ) ;
812- sprite . changeAnimation ( 'anim' + move ) ;
813- if ( sprite . animation . looping ) {
814- sprite . looping_frame = 0 ;
809+
810+ if ( sprite . isGenDancer ) {
811+ this . setGeneratedDancerMove ( move ) ;
812+ } else {
813+ sprite . changeAnimation ( 'anim' + move ) ;
814+ if ( sprite . animation . looping ) {
815+ sprite . looping_frame = 0 ;
816+ }
817+ sprite . animation . looping = true ;
815818 }
816819 sprite . sinceLastFrame = 0 ;
817- sprite . animation . looping = true ;
818820 sprite . current_move = move ;
819821 sprite . alternatingMoveInfo = undefined ;
820822 }
0 commit comments