neingeist
/
30shooter
Archived
1
0
Fork 0
master
neingeist 12 years ago
parent d461213cae
commit f342a8399a

@ -3,13 +3,13 @@
<head> <head>
<script type="text/javascript"> <script type="text/javascript">
player_pos = [300, 0]; player_pos = [300, 0];
enemy_pos = [300, 0]; enemy_pos = [300, 0];
pewpew = 0; pewpew = 0;
document.onkeydown = onKeyDown; document.onkeydown = onKeyDown;
function onKeyDown(e) { function onKeyDown(e) {
e = e || window.event; e = e || window.event;
var player = document.getElementById("player"); var player = document.getElementById("player");
@ -23,13 +23,13 @@
if (e.keyCode == '32') { // space = fire if (e.keyCode == '32') { // space = fire
shoot(player_pos); shoot(player_pos);
} }
} }
shoots = []; shoots = [];
function shoot(player_pos) { function shoot(player_pos) {
shoots[shoots.length] = [player_pos[0], 500]; shoots[shoots.length] = [player_pos[0], 500];
// pewpew = 5; // pewpew = 5;
} }
function isCollided(a, b) { function isCollided(a, b) {
var a_left = parseInt(a.style.left); var a_left = parseInt(a.style.left);