cutechicken commited on
Commit
99bd0bc
ยท
verified ยท
1 Parent(s): ccd0f92

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +49 -0
game.js CHANGED
@@ -3093,6 +3093,55 @@ class Game {
3093
  console.log('๊ฒŒ์ž„ ์‹œ์ž‘!');
3094
  }
3095
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3096
  startBGM() {
3097
  if (this.bgmPlaying || !this.bgm) return;
3098
 
 
3093
  console.log('๊ฒŒ์ž„ ์‹œ์ž‘!');
3094
  }
3095
 
3096
+ showSubtitle(text, duration) {
3097
+ // DOM์ด ์ค€๋น„๋  ๋•Œ๊นŒ์ง€ ์•ฝ๊ฐ„ ๋Œ€๊ธฐ
3098
+ setTimeout(() => {
3099
+ // ๊ธฐ์กด ์ž๋ง‰ ์ œ๊ฑฐ
3100
+ const existingSubtitle = document.getElementById('gameSubtitle');
3101
+ if (existingSubtitle) {
3102
+ existingSubtitle.remove();
3103
+ }
3104
+
3105
+ // ์ƒˆ ์ž๋ง‰ ์ƒ์„ฑ
3106
+ const subtitle = document.createElement('div');
3107
+ subtitle.id = 'gameSubtitle';
3108
+ subtitle.style.cssText = `
3109
+ position: fixed;
3110
+ bottom: 100px;
3111
+ left: 50%;
3112
+ transform: translateX(-50%);
3113
+ color: #ffffff;
3114
+ font-size: 24px;
3115
+ font-weight: bold;
3116
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
3117
+ background: rgba(0,0,0,0.7);
3118
+ padding: 15px 30px;
3119
+ border-radius: 5px;
3120
+ z-index: 2000;
3121
+ text-align: center;
3122
+ max-width: 80%;
3123
+ pointer-events: none;
3124
+ `;
3125
+ subtitle.textContent = text;
3126
+ document.body.appendChild(subtitle);
3127
+
3128
+ console.log('Subtitle displayed:', text);
3129
+
3130
+ // ์ง€์ •๋œ ์‹œ๊ฐ„ ํ›„ ์ œ๊ฑฐ
3131
+ setTimeout(() => {
3132
+ if (subtitle && subtitle.parentNode) {
3133
+ subtitle.style.transition = 'opacity 0.5s';
3134
+ subtitle.style.opacity = '0';
3135
+ setTimeout(() => {
3136
+ if (subtitle && subtitle.parentNode) {
3137
+ subtitle.remove();
3138
+ }
3139
+ }, 500);
3140
+ }
3141
+ }, duration);
3142
+ }, 100);
3143
+ }
3144
+
3145
  startBGM() {
3146
  if (this.bgmPlaying || !this.bgm) return;
3147