Spaces:
Running
Running
Update game.js
Browse files
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 |
|