Spaces:
Running
Running
Update index.html
Browse files- index.html +9 -8
index.html
CHANGED
@@ -210,14 +210,15 @@
|
|
210 |
items = [];
|
211 |
startCountdown();
|
212 |
}
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
221 |
canvas.addEventListener('mousemove', (e) => {
|
222 |
player.angle = Math.atan2(e.clientY - player.y, e.clientX - player.x);
|
223 |
});
|
|
|
210 |
items = [];
|
211 |
startCountdown();
|
212 |
}
|
213 |
+
document.addEventListener('keydown', e => {
|
214 |
+
keys[e.key] = true;
|
215 |
+
if(e.key.toLowerCase() === 'c') {
|
216 |
+
currentWeapon = currentWeapon === 'cannon' ? 'machinegun' : 'cannon';
|
217 |
+
weaponInfo.textContent = `Current Weapon: ${currentWeapon.charAt(0).toUpperCase() + currentWeapon.slice(1)}`;
|
218 |
+
} else if(e.key.toLowerCase() === 'r') {
|
219 |
+
autoFire = !autoFire;
|
220 |
+
}
|
221 |
+
});
|
222 |
canvas.addEventListener('mousemove', (e) => {
|
223 |
player.angle = Math.atan2(e.clientY - player.y, e.clientX - player.x);
|
224 |
});
|