cutechicken commited on
Commit
103f687
·
verified ·
1 Parent(s): 10242f9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -12
index.html CHANGED
@@ -248,7 +248,9 @@
248
  // 플레이어의 기본 상태를 저장
249
  const defaultPlayerStats = {
250
  maxHealth: 1000,
251
- speed: 5
 
 
252
  };
253
  function buyTank(tankImg, cost, tankId) {
254
  if (gold >= cost) {
@@ -256,18 +258,20 @@ function buyTank(tankImg, cost, tankId) {
256
  playerImg.src = tankImg;
257
  document.getElementById(tankId).style.display = 'none';
258
  document.getElementById('shop').style.display = 'none';
259
- // 먼저 플레이어 스탯을 기본값으로 초기화
260
- player.maxHealth = defaultPlayerStats.maxHealth;
261
- player.speed = defaultPlayerStats.speed;
262
- // 구매한 모든 전차의 효과를 한 번에 적용
263
- if (document.getElementById('tank1').style.display === 'none') { // PZ.IV 구매 여부
264
- player.maxHealth += 500;
265
- }
266
- if (document.getElementById('tank2').style.display === 'none') { // TIGER 구매 여부
267
- player.maxHealth += 1000;
268
- player.speed *= 0.7;
 
 
269
  }
270
- // 현재 체력을 새로운 최대 체력으로 설정
271
  player.health = player.maxHealth;
272
  }
273
  }
 
248
  // 플레이어의 기본 상태를 저장
249
  const defaultPlayerStats = {
250
  maxHealth: 1000,
251
+ speed: 5,
252
+ width: 100,
253
+ height: 45
254
  };
255
  function buyTank(tankImg, cost, tankId) {
256
  if (gold >= cost) {
 
258
  playerImg.src = tankImg;
259
  document.getElementById(tankId).style.display = 'none';
260
  document.getElementById('shop').style.display = 'none';
261
+
262
+ if (tankId === 'tank1') { // PZ.IV
263
+ player.maxHealth = 1500;
264
+ player.speed = defaultPlayerStats.speed; // 기본 이동속도로 복구
265
+ player.width = 95; // PZ.IV 크기 설정
266
+ player.height = 55; // PZ.IV의 크기 설정
267
+ }
268
+ else if (tankId === 'tank2') { // TIGER
269
+ player.maxHealth = 2000;
270
+ player.speed = defaultPlayerStats.speed * 0.7;
271
+ player.width = 100; // TIGER는 기본 크기 유지
272
+ player.height = 45; // TIGER는 기본 크기 유지
273
  }
274
+
275
  player.health = player.maxHealth;
276
  }
277
  }