File size: 10,560 Bytes
2523f3b
 
 
 
 
e52c580
2523f3b
 
 
 
 
 
 
576e1ec
8d7fbfa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2523f3b
 
 
 
 
 
 
 
 
 
576e1ec
 
2523f3b
 
 
 
 
 
 
 
576e1ec
 
2523f3b
 
 
576e1ec
 
2523f3b
 
 
 
576e1ec
 
2523f3b
 
 
 
 
576e1ec
 
2523f3b
 
 
 
 
 
 
 
 
 
 
 
3799414
 
2523f3b
e44b683
d9a71bb
e44b683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b5b0c77
3799414
b5b0c77
 
 
 
e44b683
b5b0c77
 
3799414
b5b0c77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e44b683
 
 
 
b5b0c77
3799414
2523f3b
 
 
 
 
 
 
 
 
 
 
576e1ec
efd2261
2523f3b
 
 
 
 
576e1ec
efd2261
2523f3b
 
 
 
 
 
 
 
 
 
 
 
efd2261
55f177c
2523f3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eade4f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55f177c
eade4f6
 
 
 
 
 
 
 
 
55f177c
 
 
 
 
 
 
 
 
 
 
 
 
eade4f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efd2261
2523f3b
 
 
 
 
 
 
 
 
 
 
 
 
efd2261
2523f3b
 
 
 
 
 
 
 
 
 
 
 
efd2261
 
5ced9a9
2523f3b
 
 
 
 
 
 
 
 
efd2261
5ced9a9
 
2523f3b
efd2261
 
2523f3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5ced9a9
2523f3b
f043b41
2523f3b
 
 
 
 
 
 
 
04f91c9
2523f3b
 
eade4f6
55f177c
eade4f6
 
5b22bd1
eade4f6
 
accbc97
8d7fbfa
eade4f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5b22bd1
eaa874e
 
 
 
 
 
 
 
2523f3b
55f177c
f043b41
 
 
55f177c
f043b41
2523f3b
 
 
 
 
 
 
 
 
eaa874e
2523f3b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r17/Stats.min.js"></script>
    <title>Tank Combat Simulator - FPS Mode</title>
    <style>
        body { 
            margin: 0;
            overflow: hidden;
            background: #000;
            font-family: 'Courier New', monospace;
        }
        #enemyLabels {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }
        
        .enemy-label {
            position: absolute;
            background-color: rgba(255, 0, 0, 0.7);
            color: white;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 12px;
            font-family: Arial, sans-serif;
            transform: translate(-50%, -50%);
            white-space: nowrap;
        }
        #loading {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.8);
            padding: 20px;
            border-radius: 10px;
            z-index: 2000;
            text-align: center;
        }

        .loading-spinner {
            width: 50px;
            height: 50px;
            border: 5px solid #0f0;
            border-top: 5px solid transparent;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .loading-text {
            color: #0f0;
            font-size: 24px;
            text-align: center;
        }

        #gameContainer {
            position: relative;
            width: 100vw;
            height: 100vh;
            cursor: crosshair;
        }

        #info {
            position: absolute;
            top: 10px;
            left: 10px;
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px;
            font-size: 14px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
            user-select: none;
        }

        #crosshair {
    position: fixed;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 2px solid #00ff00;
    border-radius: 50%;
    z-index: 1001;
    pointer-events: none;
    transition: all 0.2s ease;
}

/* ๋ฌผ์ฒด๊ฐ€ ๊ฐ์ง€๋˜์—ˆ์„ ๋•Œ์˜ ์Šคํƒ€์ผ */
#crosshair.target-detected {
    border-color: #ff0000;
    border-width: 3px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: #00ff00;
    transition: all 0.2s ease;
}

#crosshair::before {
    top: 50%;
    left: -10px;
    right: -10px;
    height: 2px;
    transform: translateY(-50%);
}

#crosshair::after {
    left: 50%;
    top: -10px;
    bottom: -10px;
    width: 2px;
    transform: translateX(-50%);
}

/* ๋ฌผ์ฒด๊ฐ€ ๊ฐ์ง€๋˜์—ˆ์„ ๋•Œ์˜ ํฌ๋กœ์Šค ๋ผ์ธ ์Šคํƒ€์ผ */
#crosshair.target-detected::before,
#crosshair.target-detected::after {
    background: #ff0000;
}

        #healthBar {
            position: absolute;
            bottom: 20px;
            left: 20px;
            width: 200px;
            height: 20px;
            background: rgba(0,20,0,0.7);
            border: 2px solid #0f0;
            z-index: 1001;
            border-radius: 10px;
            overflow: hidden;
        }

        #health {
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, #0f0, #00ff00);
            transition: width 0.3s;
        }

        #ammo {
            position: absolute;
            bottom: 20px;
            right: 20px;
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px;
            font-size: 20px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
        }

      
        #gameTitle {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px 20px;
            font-size: 20px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
            text-transform: uppercase;
            letter-spacing: 2px;
        }
        #ammoDisplay {
            position: absolute;
            bottom: 20px;
            right: 20px;
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px;
            font-size: 20px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
        }
        
        #reloadingText {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #ff0000;
            font-size: 24px;
            font-weight: bold;
            display: none;
            z-index: 1002;
        }
        
        #radar {
            position: absolute;
            bottom: 60px; /* ์ฒด๋ ฅ๋ฐ” ์œ„๋กœ ์ด๋™ */
            left: 20px;
            width: 200px;
            height: 200px;
            background: rgba(0,20,0,0.3);
            border: 2px solid #0f0;
            border-radius: 50%;
            z-index: 1001;
            overflow: hidden;
        }
      
        #mission {
            position: absolute;
            top: 10px;
            left: 10px;
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px;
            font-size: 16px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
        }
        
        #radarLine {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 50%;
            height: 2px;
            background: #0f0;
            transform-origin: left center;
            animation: radar-sweep 4s infinite linear;
        }
        
        .enemy-dot {
            position: absolute;
            width: 6px;
            height: 6px;
            background: #ff0000;
            border-radius: 50%;
            transform: translate(-50%, -50%);
        }
        
        @keyframes radar-sweep {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }

        #gameStats {
            position: absolute;
            top: 10px;
            right: 20px;
            color: #0f0;
            background: rgba(0,20,0,0.7);
            padding: 10px;
            font-size: 16px;
            z-index: 1001;
            border: 1px solid #0f0;
            border-radius: 5px;
            text-align: right;
        }

        .start-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            z-index: 2000;
        }

       .start-button {
            padding: 15px 30px;
            font-size: 24px;
            background: #0f0;
            color: #000;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-top: 20px;
            transition: transform 0.2s;
        }
        
        .start-button:hover {
            transform: scale(1.1);
        }

        #minimap {
            position: absolute;
            bottom: 20px;
            right: 20px;
            width: 200px;
            height: 200px;
            background: rgba(0,20,0,0.7);
            border: 2px solid #0f0;
            border-radius: 5px;
            z-index: 1001;
        }
    </style>
</head>
<body>
    <div id="loading">
        <div class="loading-spinner"></div>
        <div class="loading-text">Loading tank assets...</div>
    </div>

         <div class="start-screen" id="startScreen">
        <h1 style="color: #0f0; font-size: 48px; margin-bottom: 20px;">Tank Combat Simulator</h1>
        <button class="start-button" onclick="startGame()">Start Game</button>
        <div style="color: #0f0; margin-top: 20px; text-align: center;">
            <p>Controls:</p>
            <p>W,A,S,D - Move Tank</p>
            <p>Mouse - Look Around</p>
            <p>Left Click - Fire</p>
            <p>ESC - Pause</p>
        </div>
    </div>

    
    <div id="gameContainer">
    <div id="gameTitle">Tank Combat Simulator</div>
    <div id="mission">MISSION: SURVIVE 180 SEC</div>
    <div id="gameStats">
        <div id="score">Score: 0</div>
        <div id="time">Time: 180s</div>
    </div>
    <div id="crosshair"></div>
    <div id="detected" style="position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%); color: red; font-size: 16px; display: none;">DETECTED</div>
    <div id="enemyLabels"></div>
    
    <!-- ์ฒด๋ ฅ๋ฐ” -->
    <div id="healthBar">
        <div id="health"></div>
    </div>
    
    <!-- ์ƒˆ๋กœ์šด ํƒ„์•ฝ ์‹œ์Šคํ…œ -->
    <div id="ammoDisplay">APFSDS: 1/1</div>
    
    <!-- ๋ฆฌ๋กœ๋”ฉ ํ…์ŠคํŠธ -->
    <div id="reloadingText">RELOADING...</div>
    
    <!-- ๋ ˆ์ด๋” -->
    <div id="radar">
        <div id="radarLine"></div>
    </div>
</div>

    <script type="importmap">
        {
            "imports": {
                "three": "https://unpkg.com/three@0.157.0/build/three.module.js",
                "three/addons/": "https://unpkg.com/three@0.157.0/examples/jsm/"
            }
        }
    </script>
    <script>
        function startGame() {
            document.getElementById('startScreen').style.display = 'none';
            // ์—ฌ๊ธฐ์— ๊ฒŒ์ž„ ์‹œ์ž‘ ๋กœ์ง ์ถ”๊ฐ€
            document.body.requestPointerLock();
        }

        // ํฌ์ธํ„ฐ ๋ฝ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ
        document.addEventListener('pointerlockchange', () => {
            if (document.pointerLockElement === document.body) {
                console.log('Pointer locked');
            } else {
                console.log('Pointer unlocked');
            }
        });
    </script>
    <script type="module" src="game.js"></script>
</body>
</html>