@@ -35,17 +35,19 @@ const COIN_CHANCE = 0.22;
3535const COIN_SCALE = 0.55 ;
3636const CLOUD_SCROLL_SPEED = 0.006 ;
3737const BASE_BG_COLOR = 0x9fd7ff ;
38- const HUD_BASE_HEIGHT = 60 ;
39- const HUD_BASE_PADDING = 16 ;
40- const HUD_BASE_CONTENT_OFFSET_Y = 4 ;
38+ const HUD_BASE_HEIGHT = 76 ;
39+ const HUD_BASE_PADDING = 20 ;
40+ const HUD_BASE_CONTENT_OFFSET_Y = 0 ;
4141const HUD_DEPTH = 10 ;
4242const HUD_TEXT_DEPTH = 12 ;
43- const HUD_BASE_FONT_SIZE = 22 ;
44- const HUD_BASE_COIN_SCALE = 0.35 ;
45- const HUD_BASE_COIN_GAP = 8 ;
46- const HUD_BASE_FISH_SCALE = 0.4 ;
47- const HUD_BASE_FISH_GAP = 8 ;
48- const HUD_BASE_GROUP_GAP = 16 ;
43+ const HUD_BASE_SCORE_FONT_SIZE = 32 ;
44+ const HUD_BASE_TIME_FONT_SIZE = 26 ;
45+ const HUD_BASE_STAT_FONT_SIZE = 24 ;
46+ const HUD_BASE_COIN_SCALE = 0.45 ;
47+ const HUD_BASE_COIN_GAP = 9 ;
48+ const HUD_BASE_FISH_SCALE = 0.5 ;
49+ const HUD_BASE_FISH_GAP = 9 ;
50+ const HUD_BASE_GROUP_GAP = 18 ;
4951const HUD_MAX_SCALE = 1.35 ;
5052const GAME_OVER_OVERLAY_ALPHA = 0.55 ;
5153const GAME_OVER_PANEL_MAX_WIDTH = 0.78 ;
@@ -67,7 +69,7 @@ const FISH_MAX_SPEED = 180;
6769const FISH_MIN_HEIGHT = 60 ;
6870const FISH_MAX_HEIGHT = 160 ;
6971const FISH_MAX_POWER = 4 ;
70- const FISH_PULSE_MULTIPLIER = 1.12 ;
72+ const FISH_PULSE_MULTIPLIER = 1.1 ;
7173const FISH_PULSE_DURATION = 220 ;
7274
7375export class GameScene extends Phaser . Scene {
@@ -95,11 +97,14 @@ export class GameScene extends Phaser.Scene {
9597 private fishPowerCount = 0 ;
9698 private fishPulseTween ?: Phaser . Tweens . Tween ;
9799 private hudBackground ! : Phaser . GameObjects . Image ;
98- private hudScale = 1 ;
100+ private hudFrame ! : Phaser . GameObjects . Image ;
101+ private uiScale = 1 ;
99102 private hudHeight = HUD_BASE_HEIGHT ;
100103 private hudPadding = HUD_BASE_PADDING ;
101104 private hudContentOffsetY = HUD_BASE_CONTENT_OFFSET_Y ;
102- private hudFontSize = HUD_BASE_FONT_SIZE ;
105+ private hudScoreFontSize = HUD_BASE_SCORE_FONT_SIZE ;
106+ private hudTimeFontSize = HUD_BASE_TIME_FONT_SIZE ;
107+ private hudStatFontSize = HUD_BASE_STAT_FONT_SIZE ;
103108 private hudCoinScale = HUD_BASE_COIN_SCALE ;
104109 private hudFishScale = HUD_BASE_FISH_SCALE ;
105110 private hudCoinGap = HUD_BASE_COIN_GAP ;
@@ -731,30 +736,51 @@ export class GameScene extends Phaser.Scene {
731736
732737 private createHud ( viewportWidth : number , viewportHeight : number ) {
733738 this . hudBackground = this . add . image ( 0 , 0 , UI_RECTANGLE_GRADIENT ) . setOrigin ( 0 , 0 ) ;
734- this . hudBackground . setAlpha ( 0.85 ) ;
739+ this . hudBackground . setAlpha ( 0.88 ) ;
735740 this . hudBackground . setDepth ( HUD_DEPTH ) ;
736741 this . hudBackground . setDisplaySize ( viewportWidth , HUD_BASE_HEIGHT ) ;
742+ this . hudFrame = this . add . image ( 0 , 0 , UI_RECTANGLE_DEPTH_LINE ) . setOrigin ( 0 , 0 ) ;
743+ this . hudFrame . setAlpha ( 0.9 ) ;
744+ this . hudFrame . setDepth ( HUD_DEPTH + 1 ) ;
745+ this . hudFrame . setDisplaySize ( viewportWidth , HUD_BASE_HEIGHT ) ;
737746
738- const textStyle : Phaser . Types . GameObjects . Text . TextStyle = {
739- fontSize : `${ HUD_BASE_FONT_SIZE } px` ,
747+ const scoreStyle : Phaser . Types . GameObjects . Text . TextStyle = {
748+ fontSize : `${ HUD_BASE_SCORE_FONT_SIZE } px` ,
749+ fontStyle : '700' ,
750+ color : '#ffffff' ,
751+ stroke : '#0c1b2d' ,
752+ strokeThickness : 2
753+ } ;
754+
755+ const timeStyle : Phaser . Types . GameObjects . Text . TextStyle = {
756+ fontSize : `${ HUD_BASE_TIME_FONT_SIZE } px` ,
757+ fontStyle : '600' ,
758+ color : '#e6efff' ,
759+ stroke : '#0c1b2d' ,
760+ strokeThickness : 2
761+ } ;
762+
763+ const statStyle : Phaser . Types . GameObjects . Text . TextStyle = {
764+ fontSize : `${ HUD_BASE_STAT_FONT_SIZE } px` ,
765+ fontStyle : '600' ,
740766 color : '#f6f7fb' ,
741- stroke : '#1d1e2c ' ,
742- strokeThickness : 1
767+ stroke : '#0c1b2d ' ,
768+ strokeThickness : 2
743769 } ;
744770
745- this . scoreText = this . add . text ( 0 , 0 , '' , textStyle ) . setOrigin ( 0 , 0.5 ) ;
771+ this . scoreText = this . add . text ( 0 , 0 , '' , scoreStyle ) . setOrigin ( 0 , 0.5 ) ;
746772 this . scoreText . setDepth ( HUD_TEXT_DEPTH ) ;
747773 this . scoreText . setShadow ( 0 , 2 , '#0b0b0b' , 2 , true , true ) ;
748774
749- this . timeText = this . add . text ( 0 , 0 , '' , textStyle ) . setOrigin ( 0.5 , 0.5 ) ;
775+ this . timeText = this . add . text ( 0 , 0 , '' , timeStyle ) . setOrigin ( 0.5 , 0.5 ) ;
750776 this . timeText . setDepth ( HUD_TEXT_DEPTH ) ;
751777 this . timeText . setShadow ( 0 , 2 , '#0b0b0b' , 2 , true , true ) ;
752778
753779 this . coinIcon = this . add . image ( 0 , 0 , COIN_1 ) . setOrigin ( 0 , 0.5 ) ;
754780 this . coinIcon . setScale ( HUD_BASE_COIN_SCALE ) ;
755781 this . coinIcon . setDepth ( HUD_TEXT_DEPTH ) ;
756782
757- this . coinText = this . add . text ( 0 , 0 , '' , textStyle ) . setOrigin ( 0 , 0.5 ) ;
783+ this . coinText = this . add . text ( 0 , 0 , '' , statStyle ) . setOrigin ( 0 , 0.5 ) ;
758784 this . coinText . setDepth ( HUD_TEXT_DEPTH ) ;
759785 this . coinText . setShadow ( 0 , 2 , '#0b0b0b' , 2 , true , true ) ;
760786
@@ -768,7 +794,7 @@ export class GameScene extends Phaser.Scene {
768794 this . fishOverlay = this . add . rectangle ( 0 , 0 , 1 , 1 , 0x0b0b0b , 0.65 ) . setOrigin ( 0 , 0 ) ;
769795 this . fishOverlay . setDepth ( HUD_TEXT_DEPTH + 1 ) ;
770796
771- this . fishText = this . add . text ( 0 , 0 , '0/4' , textStyle ) . setOrigin ( 0 , 0.5 ) ;
797+ this . fishText = this . add . text ( 0 , 0 , '0/4' , statStyle ) . setOrigin ( 0 , 0.5 ) ;
772798 this . fishText . setDepth ( HUD_TEXT_DEPTH ) ;
773799 this . fishText . setShadow ( 0 , 2 , '#0b0b0b' , 2 , true , true ) ;
774800
@@ -783,32 +809,36 @@ export class GameScene extends Phaser.Scene {
783809 private resizeHud ( viewportWidth : number , viewportHeight : number ) {
784810 this . applyHudScale ( viewportWidth , viewportHeight ) ;
785811 this . hudBackground . setDisplaySize ( viewportWidth , this . hudHeight ) ;
786- this . scoreText . setFontSize ( this . hudFontSize ) ;
787- this . timeText . setFontSize ( this . hudFontSize ) ;
788- this . coinText . setFontSize ( this . hudFontSize ) ;
789- this . fishText . setFontSize ( this . hudFontSize ) ;
812+ this . hudFrame . setDisplaySize ( viewportWidth , this . hudHeight ) ;
813+ this . scoreText . setFontSize ( this . hudScoreFontSize ) ;
814+ this . timeText . setFontSize ( this . hudTimeFontSize ) ;
815+ this . coinText . setFontSize ( this . hudStatFontSize ) ;
816+ this . fishText . setFontSize ( this . hudStatFontSize ) ;
790817 this . coinIcon . setScale ( this . hudCoinScale ) ;
791818 this . fishIcon . setScale ( this . hudFishScale ) ;
792819 this . layoutHud ( viewportWidth ) ;
793820 }
794821
795822 private applyHudScale ( viewportWidth : number , viewportHeight : number ) {
796823 const baseScale = Math . min ( viewportWidth / GAME_WIDTH , viewportHeight / GAME_HEIGHT ) ;
797- this . hudScale = Phaser . Math . Clamp ( baseScale , 1 , HUD_MAX_SCALE ) ;
798- this . hudHeight = Math . round ( HUD_BASE_HEIGHT * this . hudScale ) ;
799- this . hudPadding = Math . round ( HUD_BASE_PADDING * this . hudScale ) ;
800- this . hudContentOffsetY = Math . round ( HUD_BASE_CONTENT_OFFSET_Y * this . hudScale ) ;
801- this . hudFontSize = Math . round ( Phaser . Math . Clamp ( HUD_BASE_FONT_SIZE * this . hudScale , 22 , 30 ) ) ;
802- this . hudCoinScale = HUD_BASE_COIN_SCALE * this . hudScale ;
803- this . hudFishScale = HUD_BASE_FISH_SCALE * this . hudScale ;
804- this . hudCoinGap = Math . round ( HUD_BASE_COIN_GAP * this . hudScale ) ;
805- this . hudFishGap = Math . round ( HUD_BASE_FISH_GAP * this . hudScale ) ;
806- this . hudGroupGap = Math . round ( HUD_BASE_GROUP_GAP * this . hudScale ) ;
824+ this . uiScale = Phaser . Math . Clamp ( baseScale , 1 , HUD_MAX_SCALE ) ;
825+ this . hudHeight = Math . round ( HUD_BASE_HEIGHT * this . uiScale ) ;
826+ this . hudPadding = Math . round ( HUD_BASE_PADDING * this . uiScale ) ;
827+ this . hudContentOffsetY = Math . round ( HUD_BASE_CONTENT_OFFSET_Y * this . uiScale ) ;
828+ this . hudScoreFontSize = Math . round ( HUD_BASE_SCORE_FONT_SIZE * this . uiScale ) ;
829+ this . hudTimeFontSize = Math . round ( HUD_BASE_TIME_FONT_SIZE * this . uiScale ) ;
830+ this . hudStatFontSize = Math . round ( HUD_BASE_STAT_FONT_SIZE * this . uiScale ) ;
831+ this . hudCoinScale = HUD_BASE_COIN_SCALE * this . uiScale ;
832+ this . hudFishScale = HUD_BASE_FISH_SCALE * this . uiScale ;
833+ this . hudCoinGap = Math . round ( HUD_BASE_COIN_GAP * this . uiScale ) ;
834+ this . hudFishGap = Math . round ( HUD_BASE_FISH_GAP * this . uiScale ) ;
835+ this . hudGroupGap = Math . round ( HUD_BASE_GROUP_GAP * this . uiScale ) ;
807836 }
808837
809838 private layoutHud ( viewportWidth : number ) {
810839 const centerY = this . hudHeight / 2 + this . hudContentOffsetY ;
811840 this . hudBackground . setPosition ( 0 , 0 ) ;
841+ this . hudFrame . setPosition ( 0 , 0 ) ;
812842 this . scoreText . setPosition ( this . hudPadding , centerY ) ;
813843 this . timeText . setPosition ( viewportWidth / 2 , centerY ) ;
814844
0 commit comments