Spaces:
Running
Running
Update index.html
Browse files- index.html +8 -4
index.html
CHANGED
@@ -260,7 +260,9 @@
|
|
260 |
// 플레이어의 기본 상태를 저장
|
261 |
const defaultPlayerStats = {
|
262 |
maxHealth: 1000,
|
263 |
-
speed: 5
|
|
|
|
|
264 |
};
|
265 |
function buyTank(tankImg, cost, tankId) {
|
266 |
if (gold >= cost) {
|
@@ -269,17 +271,19 @@ function buyTank(tankImg, cost, tankId) {
|
|
269 |
document.getElementById(tankId).style.display = 'none';
|
270 |
document.getElementById('shop').style.display = 'none';
|
271 |
|
272 |
-
// 각 전차 타입에 따라 스탯 직접 설정
|
273 |
if (tankId === 'tank1') { // PZ.IV
|
274 |
player.maxHealth = 1500;
|
275 |
player.speed = defaultPlayerStats.speed; // 기본 이동속도로 복구
|
|
|
|
|
276 |
}
|
277 |
else if (tankId === 'tank2') { // TIGER
|
278 |
player.maxHealth = 2000;
|
279 |
-
player.speed = defaultPlayerStats.speed * 0.7;
|
|
|
|
|
280 |
}
|
281 |
|
282 |
-
// 현재 체력을 새로운 최대 체력으로 설정
|
283 |
player.health = player.maxHealth;
|
284 |
}
|
285 |
}
|
|
|
260 |
// 플레이어의 기본 상태를 저장
|
261 |
const defaultPlayerStats = {
|
262 |
maxHealth: 1000,
|
263 |
+
speed: 5,
|
264 |
+
width: 100,
|
265 |
+
height: 45
|
266 |
};
|
267 |
function buyTank(tankImg, cost, tankId) {
|
268 |
if (gold >= cost) {
|
|
|
271 |
document.getElementById(tankId).style.display = 'none';
|
272 |
document.getElementById('shop').style.display = 'none';
|
273 |
|
|
|
274 |
if (tankId === 'tank1') { // PZ.IV
|
275 |
player.maxHealth = 1500;
|
276 |
player.speed = defaultPlayerStats.speed; // 기본 이동속도로 복구
|
277 |
+
player.width = 100; // PZ.IV의 크기 설정
|
278 |
+
player.height = 60; // PZ.IV의 크기 설정
|
279 |
}
|
280 |
else if (tankId === 'tank2') { // TIGER
|
281 |
player.maxHealth = 2000;
|
282 |
+
player.speed = defaultPlayerStats.speed * 0.7;
|
283 |
+
player.width = 100; // TIGER는 기본 크기 유지
|
284 |
+
player.height = 45; // TIGER는 기본 크기 유지
|
285 |
}
|
286 |
|
|
|
287 |
player.health = player.maxHealth;
|
288 |
}
|
289 |
}
|