cutechicken commited on
Commit
1506433
โ€ข
1 Parent(s): 3bf28e4

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +11 -10
game.js CHANGED
@@ -377,6 +377,7 @@ startReload() {
377
 
378
 
379
  createBullet(scene) {
 
380
  // ํฌํƒ„ ํฌ๊ธฐ ์ฆ๊ฐ€
381
  const bulletGeometry = new THREE.CylinderGeometry(0.2, 0.2, 2, 8);
382
  const bulletMaterial = new THREE.MeshBasicMaterial({ color: 0xffd700 });
@@ -838,7 +839,7 @@ class Game {
838
  // ๋ Œ๋”๋Ÿฌ ์„ค์ •
839
  this.renderer.shadowMap.enabled = true;
840
  this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
841
- this.renderer.outputEncoding = THREE.sRGBEncoding;
842
 
843
  // ๊ธฐ๋ณธ ์”ฌ ์„ค์ •
844
  this.setupScene();
@@ -1168,15 +1169,15 @@ class Game {
1168
  });
1169
 
1170
  document.addEventListener('click', () => {
1171
- if (!document.pointerLockElement) {
1172
- document.body.requestPointerLock();
1173
- } else if (!this.isGameOver) {
1174
- const bullet = this.tank.shoot(this.scene);
1175
- if (bullet) {
1176
- // Shooting effects could be added here
1177
- }
1178
- }
1179
- });
1180
 
1181
  document.addEventListener('pointerlockchange', () => {
1182
  if (!document.pointerLockElement) {
 
377
 
378
 
379
  createBullet(scene) {
380
+ if (!this.turret) return null; // ํ„ฐ๋ ›์ด ์—†์œผ๋ฉด null ๋ฐ˜ํ™˜
381
  // ํฌํƒ„ ํฌ๊ธฐ ์ฆ๊ฐ€
382
  const bulletGeometry = new THREE.CylinderGeometry(0.2, 0.2, 2, 8);
383
  const bulletMaterial = new THREE.MeshBasicMaterial({ color: 0xffd700 });
 
839
  // ๋ Œ๋”๋Ÿฌ ์„ค์ •
840
  this.renderer.shadowMap.enabled = true;
841
  this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
842
+ this.renderer.outputColorSpace = THREE.SRGBColorSpace;
843
 
844
  // ๊ธฐ๋ณธ ์”ฌ ์„ค์ •
845
  this.setupScene();
 
1169
  });
1170
 
1171
  document.addEventListener('click', () => {
1172
+ if (!document.pointerLockElement) {
1173
+ document.body.requestPointerLock();
1174
+ } else if (!this.isGameOver && this.tank && this.tank.isLoaded) {
1175
+ const bullet = this.tank.shoot(this.scene);
1176
+ if (bullet) {
1177
+ // Shooting effects...
1178
+ }
1179
+ }
1180
+ });
1181
 
1182
  document.addEventListener('pointerlockchange', () => {
1183
  if (!document.pointerLockElement) {