neingeist
/
30shooter
Archived
1
0
Fork 0

not so fast

master
neingeist 12 years ago
parent 4cd344cec5
commit 986e5343bf

@ -5,6 +5,7 @@ enemy_pos = [0.5 * window.innerWidth, 0.1 * window.innerHeight];
new_enemy_pos = [enemy_pos[0], enemy_pos[1]];
pewpew = 0;
herzles = 0;
lastshoot = 0;
document.onkeydown = onKeyDown;
@ -18,12 +19,15 @@ function onKeyDown(e) {
player_pos[0] += 10;
}
if (e.keyCode == '32') { // space = fire
shoot(player_pos);
if ((new Date()).getTime() - lastshoot > 300) {
shoot(player_pos);
}
}
}
shoots = [];
function shoot(pos) {
lastshoot = (new Date()).getTime();
shoots[shoots.length] = [pos[0], pos[1], false];
// pewpew = 5;
}