Archived
1
0
Fork 0

avoid the scroll bars

This commit is contained in:
neingeist 2014-09-07 19:45:51 +02:00
parent c0d554bb22
commit 2d653bcc2d
2 changed files with 7 additions and 2 deletions

View file

@ -8,6 +8,7 @@
font-size: 50px;
color: #ff00ff;
font-family: helvetica, arial;
overflow: hidden;
}
#player {
position: absolute;

View file

@ -13,10 +13,14 @@ function onKeyDown(e) {
e = e || window.event;
if (e.keyCode == '37') { // left
player_pos[0] -= 10;
if (player_pos[0] - 10 >= 0) {
player_pos[0] -= 10;
}
}
if (e.keyCode == '39') { // right
player_pos[0] += 10;
if (player_pos[0] + 10 <= window.innerWidth) {
player_pos[0] += 10;
}
}
if (e.keyCode == '32') { // space = fire
if ((new Date()).getTime() - lastshoot > 300) {