avoid the scroll bars
This commit is contained in:
parent
c0d554bb22
commit
2d653bcc2d
2 changed files with 7 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
color: #ff00ff;
|
color: #ff00ff;
|
||||||
font-family: helvetica, arial;
|
font-family: helvetica, arial;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
#player {
|
#player {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -13,11 +13,15 @@ function onKeyDown(e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
if (e.keyCode == '37') { // left
|
if (e.keyCode == '37') { // left
|
||||||
|
if (player_pos[0] - 10 >= 0) {
|
||||||
player_pos[0] -= 10;
|
player_pos[0] -= 10;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (e.keyCode == '39') { // right
|
if (e.keyCode == '39') { // right
|
||||||
|
if (player_pos[0] + 10 <= window.innerWidth) {
|
||||||
player_pos[0] += 10;
|
player_pos[0] += 10;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (e.keyCode == '32') { // space = fire
|
if (e.keyCode == '32') { // space = fire
|
||||||
if ((new Date()).getTime() - lastshoot > 300) {
|
if ((new Date()).getTime() - lastshoot > 300) {
|
||||||
shoot(player_pos);
|
shoot(player_pos);
|
||||||
|
|
Reference in a new issue