Spaces:
Running
Running
Update index.html
Browse files- index.html +9 -18
index.html
CHANGED
@@ -210,28 +210,19 @@
|
|
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 |
});
|
225 |
const keys = {};
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
document.addEventListener('keyup', e => keys[e.key] = false);
|
236 |
function fireBullet() {
|
237 |
if(isCountingDown) return;
|
|
|
210 |
items = [];
|
211 |
startCountdown();
|
212 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
canvas.addEventListener('mousemove', (e) => {
|
214 |
player.angle = Math.atan2(e.clientY - player.y, e.clientX - player.x);
|
215 |
});
|
216 |
const keys = {};
|
217 |
+
document.addEventListener('keydown', e => {
|
218 |
+
keys[e.key] = true;
|
219 |
+
if(e.key.toLowerCase() === 'c') {
|
220 |
+
currentWeapon = currentWeapon === 'cannon' ? 'machinegun' : 'cannon';
|
221 |
+
weaponInfo.textContent = `Current Weapon: ${currentWeapon.charAt(0).toUpperCase() + currentWeapon.slice(1)}`;
|
222 |
+
} else if(e.key.toLowerCase() === 'r') {
|
223 |
+
autoFire = !autoFire;
|
224 |
+
}
|
225 |
+
});
|
226 |
document.addEventListener('keyup', e => keys[e.key] = false);
|
227 |
function fireBullet() {
|
228 |
if(isCountingDown) return;
|