@@ -790,7 +790,7 @@ class MenuScene extends PhaserScene {
790790 . setOrigin ( 0.5 )
791791 . setInteractive ( )
792792 . on ( "pointerup" , ( e ) => {
793- this . scene . launch ( "HelpScene " ) ;
793+ this . scene . launch ( "HowToPlayScene1 " ) ;
794794 this . scene . stop ( ) ;
795795 } ) ;
796796 y_offset += BLOCK_SIZE * 1.5 ;
@@ -822,54 +822,100 @@ class MenuScene extends PhaserScene {
822822 }
823823}
824824
825- class HelpScene extends PhaserScene {
825+ class HowToPlayScene1 extends PhaserScene {
826826 constructor ( ) {
827- super ( { key : "HelpScene " } ) ;
827+ super ( { key : "HowToPlayScene1 " } ) ;
828828 }
829829
830830 preload ( ) {
831- this . load . text ( "helpPuzzle " , "puzzles/puzzle-help .txt" ) ;
831+ this . load . text ( "helpPuzzle1 " , "puzzles/puzzle-help1 .txt" ) ;
832832 }
833833
834834 create ( ) {
835- const puzzle = this . cache . text . get ( "helpPuzzle " ) ;
835+ const puzzle = this . cache . text . get ( "helpPuzzle1 " ) ;
836836 const board = new Board ( puzzle ) ;
837- const n = board . n ;
838- const board_y_offset = BLOCK_SIZE * 2 ;
837+ let board_y_offset = BLOCK_SIZE ;
839838
839+ this . add . text (
840+ SCREEN_WIDTH / 2 ,
841+ board_y_offset + BLOCK_H ,
842+ "Position the mirrors so each beam of light" ,
843+ TEXT_STYLE_12_PT
844+ ) . setOrigin ( 0.5 ) ;
845+ board_y_offset += BLOCK_H ;
846+ this . add . text (
847+ SCREEN_WIDTH / 2 ,
848+ board_y_offset + BLOCK_H ,
849+ "connects edges of the same colour" ,
850+ TEXT_STYLE_12_PT
851+ ) . setOrigin ( 0.5 ) ;
852+
853+ board_y_offset += BLOCK_SIZE ;
840854 drawBoardContent ( this , board , board_y_offset ) ;
841855
842- addCloseButton ( this ) ;
856+ board_y_offset += 4 * BLOCK_SIZE ;
857+
858+ board_y_offset += 3 * BLOCK_SIZE ;
859+ this . add
860+ . text ( SCREEN_WIDTH / 2 , board_y_offset , "Next" , BUTTON_STYLE )
861+ . setOrigin ( 0.5 )
862+ . setInteractive ( )
863+ . on ( "pointerup" , ( e ) => {
864+ this . scene . launch ( "HowToPlayScene2" ) ;
865+ this . scene . stop ( ) ;
866+ } ) ;
867+ }
868+ }
869+
870+ class HowToPlayScene2 extends PhaserScene {
871+ constructor ( ) {
872+ super ( { key : "HowToPlayScene2" } ) ;
873+ }
874+
875+ preload ( ) {
876+ this . load . text ( "helpPuzzle2" , "puzzles/puzzle-help2.txt" ) ;
877+ }
878+
879+ create ( ) {
880+ const puzzle = this . cache . text . get ( "helpPuzzle2" ) ;
881+ const board = new Board ( puzzle ) ;
882+ let board_y_offset = BLOCK_SIZE ;
843883
844- // Help text
845- this . add . text (
846- 0 ,
847- BLOCK_SIZE * 1.25 ,
848- "Drag all of the mirrors onto the grid, so each" ,
849- TEXT_STYLE_10_PT
850- ) ;
851884 this . add . text (
852- 0 ,
853- BLOCK_SIZE * 1.625 ,
854- "beam of light connects to the same colour" ,
855- TEXT_STYLE_10_PT
856- ) ;
857- this . add . text ( 0 , BLOCK_SIZE * 2.375 , "For example:" , TEXT_STYLE_10_PT ) ;
858- let y_offset = BLOCK_SIZE * ( n + 2 ) + board_y_offset ;
885+ SCREEN_WIDTH / 2 ,
886+ board_y_offset + BLOCK_H ,
887+ "Beams from just one edge must end" ,
888+ TEXT_STYLE_12_PT
889+ ) . setOrigin ( 0.5 ) ;
890+ board_y_offset += BLOCK_H ;
859891 this . add . text (
860- 0 ,
861- y_offset ,
862- "A new puzzle is released every day" ,
863- TEXT_STYLE_10_PT
864- ) ;
865- y_offset += BLOCK_SIZE * 0.375 ;
866- y_offset += BLOCK_SIZE * 0.375 ;
892+ SCREEN_WIDTH / 2 ,
893+ board_y_offset + BLOCK_H ,
894+ "at a mirror ball" ,
895+ TEXT_STYLE_12_PT
896+ ) . setOrigin ( 0.5 ) ;
897+
898+ drawBoardContent ( this , board , board_y_offset ) ;
899+
900+ board_y_offset += 6 * BLOCK_SIZE ;
901+
867902 this . add . text (
868- 0 ,
869- y_offset ,
870- "© 2023 Tom White (tom.e.white@gmail.com)" ,
871- TEXT_STYLE_10_PT
872- ) ;
903+ SCREEN_WIDTH / 2 ,
904+ board_y_offset + BLOCK_H ,
905+ "All mirrors must be placed on the board" ,
906+ TEXT_STYLE_12_PT
907+ ) . setOrigin ( 0.5 ) ;
908+
909+ board_y_offset += 2 * BLOCK_SIZE ;
910+ this . add
911+ . text ( SCREEN_WIDTH / 2 , board_y_offset , "Done" , BUTTON_STYLE )
912+ . setOrigin ( 0.5 )
913+ . setInteractive ( )
914+ . on ( "pointerup" , ( e ) => {
915+ this . scene . resume ( "PlayScene" ) ;
916+ this . scene . stop ( ) ;
917+ this . scene . setVisible ( true , "PlayScene" ) ;
918+ } ) ;
873919 }
874920}
875921
@@ -963,6 +1009,14 @@ class AboutScene extends PhaserScene {
9631009 TEXT_STYLE_12_PT
9641010 ) . setOrigin ( 0.5 ) ;
9651011
1012+ board_y_offset += BLOCK_SIZE ;
1013+ this . add . text (
1014+ SCREEN_WIDTH / 2 ,
1015+ board_y_offset + BLOCK_H ,
1016+ "© 2023 Tom White" ,
1017+ TEXT_STYLE_12_PT
1018+ ) . setOrigin ( 0.5 ) ;
1019+
9661020 addCloseButton ( this ) ;
9671021 }
9681022}
@@ -978,7 +1032,7 @@ if (typeof Phaser !== 'undefined') {
9781032 autoCenter : Phaser . Scale . CENTER_BOTH ,
9791033 } ,
9801034 backgroundColor : "#FFFFFF" ,
981- scene : [ PlayScene , MessageScene , MenuScene , HelpScene , SolutionScene , AboutScene ] ,
1035+ scene : [ PlayScene , MessageScene , MenuScene , HowToPlayScene1 , HowToPlayScene2 , SolutionScene , AboutScene ] ,
9821036 } ;
9831037
9841038 window . game = new Phaser . Game ( config ) ;
0 commit comments