diff --git a/sounds/AKMr.mp3 b/sounds/AKMr.mp3 new file mode 100644 index 0000000..57eccf1 Binary files /dev/null and b/sounds/AKMr.mp3 differ diff --git a/sounds/AWMr.mp3 b/sounds/AWMr.mp3 new file mode 100644 index 0000000..04c17e6 Binary files /dev/null and b/sounds/AWMr.mp3 differ diff --git a/sounds/DEagler.mp3 b/sounds/DEagler.mp3 new file mode 100644 index 0000000..08ba877 Binary files /dev/null and b/sounds/DEagler.mp3 differ diff --git a/sounds/M4A1r.mp3 b/sounds/M4A1r.mp3 new file mode 100644 index 0000000..eeb0d4d Binary files /dev/null and b/sounds/M4A1r.mp3 differ diff --git a/sounds/UZIr.mp3 b/sounds/UZIr.mp3 new file mode 100644 index 0000000..824ae81 Binary files /dev/null and b/sounds/UZIr.mp3 differ diff --git a/sounds/gunChange.mp3 b/sounds/gunChange.mp3 new file mode 100644 index 0000000..3fa6939 Binary files /dev/null and b/sounds/gunChange.mp3 differ diff --git a/src/Gun.js b/src/Gun.js index 3a2626b..bdced8f 100644 --- a/src/Gun.js +++ b/src/Gun.js @@ -150,6 +150,7 @@ class Gun { reload() { if (this.isReloading || this.isFiring) return; // Check if already reloading this.isReloading = true; // Set reloading flag + playSound(this.name+"r"); ammo.textContent = `Reloading....`; // setting color of the indicator if (this.ammo > 0) { diff --git a/src/canvas.js b/src/canvas.js index c1797d3..a7d80d8 100644 --- a/src/canvas.js +++ b/src/canvas.js @@ -73,10 +73,10 @@ player.switchSprite("IdleR"); // color: "gray", // }); Hmeter.value = player.health / 100; -const platform = new Platform({ - position: { x: canvas.width / 2 - 75, y: 250 }, - width: 150, -}); +// const platform = new Platform({ +// position: { x: canvas.width / 2 - 75, y: 250 }, +// width: 150, +// }); // creating guns const M4A1 = new Gun({ ammo: 60, @@ -210,13 +210,13 @@ sorroundings = [ cannonLeft, cannonRight, ...blocks, - platform, ]; function changeGun(gun) { if (currentGun.isFiring || currentGun.isReloading) return; // update the current gun + playSound("gunChange"); currentGun = gun; gunIcon.innerHTML = gunSvg[currentGun.name]; const factor = currentGun.magLimit / 100; @@ -318,7 +318,7 @@ function animate() { zombies[i].detectPlayerCollision(player); } player.zombies = zombies; - platform.draw(); + // platform.draw(); theta = calculateAngle(player); currentGun.draw(); cannonLeft.draw(); @@ -417,16 +417,16 @@ function animate() { } // platform collision left - if ( - player.position.y + player.height <= platform.position.y && - player.position.y + player.height + player.velocity.y >= - platform.position.y && - player.position.x + player.width >= platform.position.x && - player.position.x <= platform.position.x + platform.width - ) { - player.velocity.y = 0; - player.grounded = true; - } + // if ( + // player.position.y + player.height <= platform.position.y && + // player.position.y + player.height + player.velocity.y >= + // platform.position.y && + // player.position.x + player.width >= platform.position.x && + // player.position.x <= platform.position.x + platform.width + // ) { + // player.velocity.y = 0; + // player.grounded = true; + // } // adding fire effect if jetpack is active updateParticles(); @@ -680,16 +680,16 @@ document.querySelectorAll(".powerUp").forEach((btn, i) => { return; } player.score -= 1200; - Pvelocity = 5; + Pvelocity = 4; speedDur += 15; if (!speedPUTimeout) { speedPUTimeout = setTimeout(() => { - Pvelocity = 3; + Pvelocity = 2; }, speedDur * 1000); } else { clearTimeout(speedPUTimeout); speedPUTimeout = setTimeout(() => { - Pvelocity = 3; + Pvelocity = 2; }, speedDur * 1000); } usePowerUp(); diff --git a/src/utils.js b/src/utils.js index 28c82bc..91dc5a9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -35,7 +35,7 @@ let collisionDetected, trapInd = 0, scrollOffset = 0, damageDur = 0, - Pvelocity = 3, + Pvelocity = 2, zombieCount = 0, totalZombies = 0, zombies = [], @@ -143,7 +143,7 @@ function spawnZombies(interval) { collisionBlocks: blocks, zombies, health: 300, - speed: 0.65, + speed: 0.55, height: 75, width: 35, damage: 15, @@ -315,7 +315,7 @@ function spawnZombies(interval) { collisionBlocks: blocks, zombies, health: 210, - speed: 0.42, + speed: 0.38, damage: 10, attackFreq: 3000, color: "red", @@ -533,13 +533,19 @@ const gunSvg = { const sounds = { AWM: new Audio("./sounds/AWM2.mp3"), + AWMr: new Audio("./sounds/AWMr.mp3"), AKM: new Audio("./sounds/AKM.mp3"), + AKMr: new Audio("./sounds/AKMr.mp3"), UZI: new Audio("./sounds/UZI_Single.mp3"), + UZIr: new Audio("./sounds/UZIr.mp3"), DEagle: new Audio("./sounds/DEagle.mp3"), + DEagler: new Audio("./sounds/DEagler.mp3"), M4A1: new Audio("./sounds/M4A1.mp3"), + M4A1r: new Audio("./sounds/M4A1r.mp3"), Run: new Audio("./sounds/Run.mp3"), Jump: new Audio("./sounds/Jump.mp3"), - Jump2: new Audio("./sounds/Jump2.mp3"), + Jump: new Audio("./sounds/Jump.mp3"), + gunChange: new Audio("./sounds/gunChange.mp3"), Hurt: new Audio("./sounds/Hurt.mp3"), Hurt2: new Audio("./sounds/Hurt2.mp3"), LandMine: new Audio("./sounds/LandMine.mp3"),